-
-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into slider-server-in-pluto-export-json
- Loading branch information
Showing
27 changed files
with
2,328 additions
and
771 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,13 @@ name = "Pluto" | |
uuid = "c3e4b0f8-55cb-11ea-2926-15256bba5781" | ||
license = "MIT" | ||
authors = ["Fons van der Plas <[email protected]>"] | ||
version = "0.19.29" | ||
version = "0.19.30" | ||
|
||
[deps] | ||
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" | ||
Configurations = "5218b696-f38b-4ac9-8b61-a12ec717816d" | ||
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" | ||
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6" | ||
FileWatching = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" | ||
FuzzyCompletions = "fb4132e2-a121-4a70-b8a1-d5b831dcdcc2" | ||
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
//@ts-ignore | ||
import dialogPolyfill from "https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.esm.min.js" | ||
|
||
import { useEffect, useLayoutEffect, useRef } from "../imports/Preact.js" | ||
|
||
/** | ||
* @returns {[import("../imports/Preact.js").Ref<HTMLDialogElement?>, () => void, () => void, () => void]} | ||
*/ | ||
export const useDialog = ({ light_dismiss = false } = {}) => { | ||
const dialog_ref = useRef(/** @type {HTMLDialogElement?} */ (null)) | ||
|
||
useLayoutEffect(() => { | ||
if (dialog_ref.current != null) dialogPolyfill.registerDialog(dialog_ref.current) | ||
}, [dialog_ref.current]) | ||
|
||
//@ts-ignore | ||
const open = () => dialog_ref.current.showModal() | ||
//@ts-ignore | ||
const close = () => dialog_ref.current.close() | ||
//@ts-ignore | ||
const toggle = () => (dialog_ref.current.open ? dialog_ref.current?.close() : dialog_ref.current?.showModal()) | ||
|
||
useEffect(() => { | ||
if (light_dismiss) { | ||
const handleclick = (e) => { | ||
if (dialog_ref.current?.open && dialog_ref.current.contains(e.target)) { | ||
close() | ||
// Avoid activating whatever was below | ||
e.stopPropagation() | ||
e.preventDefault() | ||
} | ||
} | ||
document.body.addEventListener("click", handleclick) | ||
return () => { | ||
document.body.removeEventListener("click", handleclick) | ||
} | ||
} | ||
}, [dialog_ref.current]) | ||
|
||
return [dialog_ref, open, close, toggle] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import "https://cdn.jsdelivr.net/gh/fonsp/[email protected]/lib/rebel-tag-in | |
//@ts-ignore | ||
import dialogPolyfill from "https://cdn.jsdelivr.net/npm/[email protected]/dist/dialog-polyfill.esm.min.js" | ||
import immer from "../imports/immer.js" | ||
import { useDialog } from "../common/useDialog.js" | ||
|
||
/** | ||
* @param {{ | ||
|
@@ -32,15 +33,7 @@ export const FrontMatterInput = ({ remote_frontmatter, set_remote_frontmatter }) | |
}) | ||
) | ||
|
||
const dialog_ref = useRef(/** @type {HTMLDialogElement?} */ (null)) | ||
useLayoutEffect(() => { | ||
dialogPolyfill.registerDialog(dialog_ref.current) | ||
}) | ||
|
||
//@ts-ignore | ||
const open = () => dialog_ref.current.showModal() | ||
//@ts-ignore | ||
const close = () => dialog_ref.current.close() | ||
const [dialog_ref, open, close, _toggle] = useDialog({ light_dismiss: false }) | ||
|
||
const cancel = () => { | ||
set_frontmatter(remote_frontmatter ?? {}) | ||
|
Oops, something went wrong.