@mdxeditor/editor 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/MDXEditor.d.ts +5 -1
- package/dist/MDXEditor.js +3 -2
- package/dist/gurx/realm.d.ts +2 -2
- package/dist/gurx/realm.js +5 -1
- package/dist/plugins/codeblock/index.d.ts +12 -2
- package/dist/plugins/codemirror/index.d.ts +16 -2
- package/dist/plugins/core/index.d.ts +11 -2
- package/dist/plugins/core/index.js +9 -2
- package/dist/plugins/diff-source/index.d.ts +12 -2
- package/dist/plugins/directives/index.d.ts +12 -2
- package/dist/plugins/frontmatter/FrontmatterEditor.js +22 -24
- package/dist/plugins/frontmatter/index.d.ts +38 -4
- package/dist/plugins/frontmatter/index.js +25 -2
- package/dist/plugins/headings/index.d.ts +12 -2
- package/dist/plugins/image/index.d.ts +12 -2
- package/dist/plugins/jsx/index.d.ts +12 -2
- package/dist/plugins/link/index.d.ts +1 -0
- package/dist/plugins/link-dialog/LinkDialog.d.ts +3 -2
- package/dist/plugins/link-dialog/LinkDialog.js +14 -13
- package/dist/plugins/link-dialog/index.d.ts +19 -9
- package/dist/plugins/link-dialog/index.js +16 -4
- package/dist/plugins/lists/index.d.ts +12 -2
- package/dist/plugins/markdown-shortcut/index.d.ts +1 -0
- package/dist/plugins/quote/index.d.ts +9 -2
- package/dist/plugins/sandpack/index.d.ts +16 -2
- package/dist/plugins/table/index.d.ts +12 -2
- package/dist/plugins/thematic-break/index.d.ts +12 -2
- package/dist/plugins/toolbar/components/InsertFrontmatter.js +14 -1
- package/dist/plugins/toolbar/index.d.ts +10 -2
- package/dist/style.css +218 -175
- package/dist/styles/ui.module.css.js +101 -86
- package/package.json +1 -1
- package/dist/icons/arrow_right.svg.js +0 -8
|
@@ -3,7 +3,6 @@ import * as Tooltip from "@radix-ui/react-tooltip";
|
|
|
3
3
|
import React__default from "react";
|
|
4
4
|
import { createCommand } from "lexical";
|
|
5
5
|
import CheckIcon from "../../icons/check.svg.js";
|
|
6
|
-
import CloseIcon from "../../icons/close.svg.js";
|
|
7
6
|
import CopyIcon from "../../icons/content_copy.svg.js";
|
|
8
7
|
import EditIcon from "../../icons/edit.svg.js";
|
|
9
8
|
import LinkOffIcon from "../../icons/link_off.svg.js";
|
|
@@ -16,15 +15,16 @@ import { corePluginHooks } from "../core/index.js";
|
|
|
16
15
|
import { linkDialogPluginHooks } from "./index.js";
|
|
17
16
|
createCommand();
|
|
18
17
|
const MAX_SUGGESTIONS = 20;
|
|
19
|
-
function LinkEditForm({ initialUrl, onSubmit, onCancel, linkAutocompleteSuggestions }) {
|
|
18
|
+
function LinkEditForm({ initialUrl, initialTitle, onSubmit, onCancel, linkAutocompleteSuggestions }) {
|
|
20
19
|
const [items, setItems] = React__default.useState(linkAutocompleteSuggestions.slice(0, MAX_SUGGESTIONS));
|
|
21
|
-
const
|
|
20
|
+
const [title, setTitle] = React__default.useState(initialTitle);
|
|
21
|
+
const { isOpen, getToggleButtonProps, getMenuProps, getInputProps, highlightedIndex, getItemProps, selectedItem, inputValue } = useCombobox({
|
|
22
22
|
initialInputValue: initialUrl,
|
|
23
|
-
onInputValueChange({ inputValue }) {
|
|
24
|
-
|
|
23
|
+
onInputValueChange({ inputValue: inputValue2 }) {
|
|
24
|
+
inputValue2 = (inputValue2 == null ? void 0 : inputValue2.toLowerCase()) || "";
|
|
25
25
|
const matchingItems = [];
|
|
26
26
|
for (const url of linkAutocompleteSuggestions) {
|
|
27
|
-
if (url.toLowerCase().includes(
|
|
27
|
+
if (url.toLowerCase().includes(inputValue2)) {
|
|
28
28
|
matchingItems.push(url);
|
|
29
29
|
if (matchingItems.length >= MAX_SUGGESTIONS) {
|
|
30
30
|
break;
|
|
@@ -40,7 +40,7 @@ function LinkEditForm({ initialUrl, onSubmit, onCancel, linkAutocompleteSuggesti
|
|
|
40
40
|
});
|
|
41
41
|
const onSubmitEH = (e) => {
|
|
42
42
|
e.preventDefault();
|
|
43
|
-
onSubmit(
|
|
43
|
+
onSubmit([inputValue, title]);
|
|
44
44
|
};
|
|
45
45
|
const onKeyDownEH = React__default.useCallback(
|
|
46
46
|
(e) => {
|
|
@@ -49,10 +49,10 @@ function LinkEditForm({ initialUrl, onSubmit, onCancel, linkAutocompleteSuggesti
|
|
|
49
49
|
(_a = e.target.form) == null ? void 0 : _a.reset();
|
|
50
50
|
} else if (e.key === "Enter" && (!isOpen || items.length === 0)) {
|
|
51
51
|
e.preventDefault();
|
|
52
|
-
onSubmit(e.target.value);
|
|
52
|
+
onSubmit([e.target.value, title]);
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
[isOpen, items, onSubmit]
|
|
55
|
+
[isOpen, items, onSubmit, title]
|
|
56
56
|
);
|
|
57
57
|
const downshiftInputProps = getInputProps();
|
|
58
58
|
const inputProps = {
|
|
@@ -63,7 +63,7 @@ function LinkEditForm({ initialUrl, onSubmit, onCancel, linkAutocompleteSuggesti
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
const dropdownIsVisible = isOpen && items.length > 0;
|
|
66
|
-
return /* @__PURE__ */ React__default.createElement("form", { onSubmit: onSubmitEH, onReset: onCancel, className: classNames(styles.linkDialogEditForm) }, /* @__PURE__ */ React__default.createElement("div", { className: styles.linkDialogInputContainer }, /* @__PURE__ */ React__default.createElement("div", { "data-visible-dropdown": dropdownIsVisible, className: styles.linkDialogInputWrapper }, /* @__PURE__ */ React__default.createElement("input", { className: styles.linkDialogInput, ...inputProps, autoFocus: true, size:
|
|
66
|
+
return /* @__PURE__ */ React__default.createElement("form", { onSubmit: onSubmitEH, onReset: onCancel, className: classNames(styles.linkDialogEditForm) }, /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("label", { htmlFor: "link-url" }, "URL")), /* @__PURE__ */ React__default.createElement("div", { className: styles.linkDialogInputContainer }, /* @__PURE__ */ React__default.createElement("div", { "data-visible-dropdown": dropdownIsVisible, className: styles.linkDialogInputWrapper }, /* @__PURE__ */ React__default.createElement("input", { id: "link-url", className: styles.linkDialogInput, ...inputProps, autoFocus: true, size: 40, "data-editor-dialog": true }), /* @__PURE__ */ React__default.createElement("button", { "aria-label": "toggle menu", type: "button", ...getToggleButtonProps() }, /* @__PURE__ */ React__default.createElement(DropDownIcon, null))), /* @__PURE__ */ React__default.createElement("div", { className: styles.linkDialogAutocompleteContainer }, /* @__PURE__ */ React__default.createElement("ul", { ...getMenuProps(), "data-visible": dropdownIsVisible }, items.map((item, index) => /* @__PURE__ */ React__default.createElement(
|
|
67
67
|
"li",
|
|
68
68
|
{
|
|
69
69
|
"data-selected": selectedItem === item,
|
|
@@ -72,7 +72,7 @@ function LinkEditForm({ initialUrl, onSubmit, onCancel, linkAutocompleteSuggesti
|
|
|
72
72
|
...getItemProps({ item, index })
|
|
73
73
|
},
|
|
74
74
|
item
|
|
75
|
-
))))), /* @__PURE__ */ React__default.createElement(
|
|
75
|
+
))))), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("label", { htmlFor: "link-title" }, "Title")), /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", { className: styles.linkDialogInputWrapper }, /* @__PURE__ */ React__default.createElement("input", { id: "link-title", className: styles.linkDialogInput, size: 40, value: title, onChange: (e) => setTitle(e.target.value) }))), /* @__PURE__ */ React__default.createElement("div", { style: { display: "flex", justifyContent: "flex-end", gap: "var(--spacing-2)" } }, /* @__PURE__ */ React__default.createElement("button", { type: "reset", title: "Cancel change", "aria-label": "Cancel change", className: classNames(styles.secondaryButton) }, "Cancel"), /* @__PURE__ */ React__default.createElement("button", { type: "submit", title: "Set URL", "aria-label": "Set URL", className: classNames(styles.primaryButton) }, "Save")));
|
|
76
76
|
}
|
|
77
77
|
const LinkDialog = () => {
|
|
78
78
|
const [editorRootElementRef] = corePluginHooks.useEmitterValues("editorRootElementRef");
|
|
@@ -103,8 +103,8 @@ const LinkDialog = () => {
|
|
|
103
103
|
const [copyUrlTooltipOpen, setCopyUrlTooltipOpen] = React__default.useState(false);
|
|
104
104
|
const theRect = linkDialogState == null ? void 0 : linkDialogState.rectangle;
|
|
105
105
|
const onSubmitEH = React__default.useCallback(
|
|
106
|
-
(
|
|
107
|
-
updateLinkUrl(
|
|
106
|
+
(payload) => {
|
|
107
|
+
updateLinkUrl(payload);
|
|
108
108
|
applyLinkChanges(true);
|
|
109
109
|
},
|
|
110
110
|
[applyLinkChanges, updateLinkUrl]
|
|
@@ -134,6 +134,7 @@ const LinkDialog = () => {
|
|
|
134
134
|
LinkEditForm,
|
|
135
135
|
{
|
|
136
136
|
initialUrl: linkDialogState.url,
|
|
137
|
+
initialTitle: linkDialogState.title,
|
|
137
138
|
onSubmit: onSubmitEH,
|
|
138
139
|
onCancel: cancelLinkEdit.bind(null, true),
|
|
139
140
|
linkAutocompleteSuggestions
|
|
@@ -26,7 +26,9 @@ type PreviewLinkDialog = {
|
|
|
26
26
|
type EditLinkDialog = {
|
|
27
27
|
type: 'edit';
|
|
28
28
|
initialUrl: string;
|
|
29
|
+
initialTitle?: string;
|
|
29
30
|
url: string;
|
|
31
|
+
title: string;
|
|
30
32
|
linkNodeKey: string;
|
|
31
33
|
rectangle: RectData;
|
|
32
34
|
};
|
|
@@ -83,6 +85,7 @@ linkDialogPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
83
85
|
applyBlockType: RealmNode<BlockType>;
|
|
84
86
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
85
87
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
88
|
+
onBlur: RealmNode<FocusEvent>;
|
|
86
89
|
}>], (r: Realm, [{ activeEditor, currentSelection, createActiveEditorSubscription }]: [{
|
|
87
90
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
88
91
|
inFocus: RealmNode<boolean>;
|
|
@@ -134,11 +137,12 @@ linkDialogPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
134
137
|
applyBlockType: RealmNode<BlockType>;
|
|
135
138
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
136
139
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
140
|
+
onBlur: RealmNode<FocusEvent>;
|
|
137
141
|
}]) => {
|
|
138
142
|
dialogState: RealmNode<boolean>;
|
|
139
143
|
onWindowChange: RealmNode<true>;
|
|
140
144
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
141
|
-
updateLinkUrl: RealmNode<string>;
|
|
145
|
+
updateLinkUrl: RealmNode<[string, string]>;
|
|
142
146
|
switchFromPreviewToLinkEdit: RealmNode<true>;
|
|
143
147
|
cancelLinkEdit: RealmNode<true>;
|
|
144
148
|
removeLink: RealmNode<true>;
|
|
@@ -154,7 +158,7 @@ linkDialogPluginHooks: {
|
|
|
154
158
|
dialogState: RealmNode<boolean>;
|
|
155
159
|
onWindowChange: RealmNode<true>;
|
|
156
160
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
157
|
-
updateLinkUrl: RealmNode<string>;
|
|
161
|
+
updateLinkUrl: RealmNode<[string, string]>;
|
|
158
162
|
switchFromPreviewToLinkEdit: RealmNode<true>;
|
|
159
163
|
cancelLinkEdit: RealmNode<true>;
|
|
160
164
|
removeLink: RealmNode<true>;
|
|
@@ -212,12 +216,13 @@ linkDialogPluginHooks: {
|
|
|
212
216
|
applyBlockType: RealmNode<BlockType>;
|
|
213
217
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
214
218
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
219
|
+
onBlur: RealmNode<FocusEvent>;
|
|
215
220
|
}>;
|
|
216
|
-
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "dialogState" | "onWindowChange" | "linkDialogState" | "updateLinkUrl" | "switchFromPreviewToLinkEdit" | "cancelLinkEdit" | "removeLink" | "openLinkEditDialog" | "applyLinkChanges" | "linkAutocompleteSuggestions">(key: K, callback: (value: ValueForKey<{
|
|
221
|
+
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "dialogState" | "onWindowChange" | "linkDialogState" | "updateLinkUrl" | "switchFromPreviewToLinkEdit" | "cancelLinkEdit" | "removeLink" | "openLinkEditDialog" | "applyLinkChanges" | "linkAutocompleteSuggestions">(key: K, callback: (value: ValueForKey<{
|
|
217
222
|
dialogState: RealmNode<boolean>;
|
|
218
223
|
onWindowChange: RealmNode<true>;
|
|
219
224
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
220
|
-
updateLinkUrl: RealmNode<string>;
|
|
225
|
+
updateLinkUrl: RealmNode<[string, string]>;
|
|
221
226
|
switchFromPreviewToLinkEdit: RealmNode<true>;
|
|
222
227
|
cancelLinkEdit: RealmNode<true>;
|
|
223
228
|
removeLink: RealmNode<true>;
|
|
@@ -275,12 +280,13 @@ linkDialogPluginHooks: {
|
|
|
275
280
|
applyBlockType: RealmNode<BlockType>;
|
|
276
281
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
277
282
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
283
|
+
onBlur: RealmNode<FocusEvent>;
|
|
278
284
|
}, K>) => void) => void;
|
|
279
285
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
280
286
|
dialogState: RealmNode<boolean>;
|
|
281
287
|
onWindowChange: RealmNode<true>;
|
|
282
288
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
283
|
-
updateLinkUrl: RealmNode<string>;
|
|
289
|
+
updateLinkUrl: RealmNode<[string, string]>;
|
|
284
290
|
switchFromPreviewToLinkEdit: RealmNode<true>;
|
|
285
291
|
cancelLinkEdit: RealmNode<true>;
|
|
286
292
|
removeLink: RealmNode<true>;
|
|
@@ -338,11 +344,12 @@ linkDialogPluginHooks: {
|
|
|
338
344
|
applyBlockType: RealmNode<BlockType>;
|
|
339
345
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
340
346
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
347
|
+
onBlur: RealmNode<FocusEvent>;
|
|
341
348
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
342
349
|
dialogState: RealmNode<boolean>;
|
|
343
350
|
onWindowChange: RealmNode<true>;
|
|
344
351
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
345
|
-
updateLinkUrl: RealmNode<string>;
|
|
352
|
+
updateLinkUrl: RealmNode<[string, string]>;
|
|
346
353
|
switchFromPreviewToLinkEdit: RealmNode<true>;
|
|
347
354
|
cancelLinkEdit: RealmNode<true>;
|
|
348
355
|
removeLink: RealmNode<true>;
|
|
@@ -400,12 +407,13 @@ linkDialogPluginHooks: {
|
|
|
400
407
|
applyBlockType: RealmNode<BlockType>;
|
|
401
408
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
402
409
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
410
|
+
onBlur: RealmNode<FocusEvent>;
|
|
403
411
|
}, K_1>;
|
|
404
412
|
usePubKeys: () => (values: SystemDict<{
|
|
405
413
|
dialogState: RealmNode<boolean>;
|
|
406
414
|
onWindowChange: RealmNode<true>;
|
|
407
415
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
408
|
-
updateLinkUrl: RealmNode<string>;
|
|
416
|
+
updateLinkUrl: RealmNode<[string, string]>;
|
|
409
417
|
switchFromPreviewToLinkEdit: RealmNode<true>;
|
|
410
418
|
cancelLinkEdit: RealmNode<true>;
|
|
411
419
|
removeLink: RealmNode<true>;
|
|
@@ -463,12 +471,13 @@ linkDialogPluginHooks: {
|
|
|
463
471
|
applyBlockType: RealmNode<BlockType>;
|
|
464
472
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
465
473
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
474
|
+
onBlur: RealmNode<FocusEvent>;
|
|
466
475
|
}>) => void;
|
|
467
|
-
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "dialogState" | "onWindowChange" | "linkDialogState" | "updateLinkUrl" | "switchFromPreviewToLinkEdit" | "cancelLinkEdit" | "removeLink" | "openLinkEditDialog" | "applyLinkChanges" | "linkAutocompleteSuggestions">(key: K_2) => (value: ValueForKey<{
|
|
476
|
+
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "dialogState" | "onWindowChange" | "linkDialogState" | "updateLinkUrl" | "switchFromPreviewToLinkEdit" | "cancelLinkEdit" | "removeLink" | "openLinkEditDialog" | "applyLinkChanges" | "linkAutocompleteSuggestions">(key: K_2) => (value: ValueForKey<{
|
|
468
477
|
dialogState: RealmNode<boolean>;
|
|
469
478
|
onWindowChange: RealmNode<true>;
|
|
470
479
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
471
|
-
updateLinkUrl: RealmNode<string>;
|
|
480
|
+
updateLinkUrl: RealmNode<[string, string]>;
|
|
472
481
|
switchFromPreviewToLinkEdit: RealmNode<true>;
|
|
473
482
|
cancelLinkEdit: RealmNode<true>;
|
|
474
483
|
removeLink: RealmNode<true>;
|
|
@@ -526,6 +535,7 @@ linkDialogPluginHooks: {
|
|
|
526
535
|
applyBlockType: RealmNode<BlockType>;
|
|
527
536
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
528
537
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
538
|
+
onBlur: RealmNode<FocusEvent>;
|
|
529
539
|
}, K_2>) => void;
|
|
530
540
|
};
|
|
531
541
|
export {};
|
|
@@ -45,7 +45,9 @@ const linkDialogSystem = system(
|
|
|
45
45
|
r.pub(linkDialogState, {
|
|
46
46
|
type: "edit",
|
|
47
47
|
initialUrl: node.getURL(),
|
|
48
|
+
initialTitle: node.getTitle() || "",
|
|
48
49
|
url: node.getURL(),
|
|
50
|
+
title: node.getTitle() || "",
|
|
49
51
|
linkNodeKey: node.getKey(),
|
|
50
52
|
rectangle
|
|
51
53
|
});
|
|
@@ -53,6 +55,8 @@ const linkDialogSystem = system(
|
|
|
53
55
|
r.pub(linkDialogState, {
|
|
54
56
|
type: "edit",
|
|
55
57
|
initialUrl: "",
|
|
58
|
+
initialTitle: "",
|
|
59
|
+
title: "",
|
|
56
60
|
url: "",
|
|
57
61
|
linkNodeKey: "",
|
|
58
62
|
rectangle
|
|
@@ -84,7 +88,7 @@ const linkDialogSystem = system(
|
|
|
84
88
|
(event) => {
|
|
85
89
|
if (event.key === "k" && (IS_APPLE ? event.metaKey : event.ctrlKey)) {
|
|
86
90
|
const selection = $getSelection();
|
|
87
|
-
if ($isRangeSelection(selection) && !selection.isCollapsed()) {
|
|
91
|
+
if ($isRangeSelection(selection) && (getLinkNodeInSelection(selection) || !selection.isCollapsed())) {
|
|
88
92
|
r.pub(openLinkEditDialog, true);
|
|
89
93
|
event.stopPropagation();
|
|
90
94
|
return true;
|
|
@@ -120,8 +124,15 @@ const linkDialogSystem = system(
|
|
|
120
124
|
r.sub(r.pipe(applyLinkChanges, r.o.withLatestFrom(linkDialogState, activeEditor)), ([, state, editor]) => {
|
|
121
125
|
if (state.type === "edit") {
|
|
122
126
|
const url = state.url.trim();
|
|
127
|
+
const title = state.title.trim();
|
|
123
128
|
if (url.trim() !== "") {
|
|
124
|
-
editor == null ? void 0 : editor.dispatchCommand(TOGGLE_LINK_COMMAND, url);
|
|
129
|
+
editor == null ? void 0 : editor.dispatchCommand(TOGGLE_LINK_COMMAND, { url, title });
|
|
130
|
+
setTimeout(() => {
|
|
131
|
+
editor == null ? void 0 : editor.update(() => {
|
|
132
|
+
const node = getLinkNodeInSelection($getSelection());
|
|
133
|
+
node == null ? void 0 : node.setTitle(title);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
125
136
|
r.pub(linkDialogState, {
|
|
126
137
|
type: "preview",
|
|
127
138
|
linkNodeKey: state.linkNodeKey,
|
|
@@ -144,11 +155,12 @@ const linkDialogSystem = system(
|
|
|
144
155
|
r.pipe(
|
|
145
156
|
updateLinkUrl,
|
|
146
157
|
r.o.withLatestFrom(linkDialogState),
|
|
147
|
-
r.o.map(([url, state]) => {
|
|
158
|
+
r.o.map(([[url, title], state]) => {
|
|
148
159
|
if (state.type === "edit") {
|
|
149
160
|
return {
|
|
150
161
|
...state,
|
|
151
|
-
url
|
|
162
|
+
url,
|
|
163
|
+
title
|
|
152
164
|
};
|
|
153
165
|
} else {
|
|
154
166
|
throw new Error("Cannot update link url when not in edit mode");
|
|
@@ -65,6 +65,7 @@ export declare const listsSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
65
65
|
applyBlockType: RealmNode<BlockType>;
|
|
66
66
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
67
67
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
68
|
+
onBlur: RealmNode<FocusEvent>;
|
|
68
69
|
}>], (r: Realm, [{ activeEditor, currentSelection }]: [{
|
|
69
70
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
70
71
|
inFocus: RealmNode<boolean>;
|
|
@@ -116,6 +117,7 @@ export declare const listsSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
116
117
|
applyBlockType: RealmNode<BlockType>;
|
|
117
118
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
118
119
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
120
|
+
onBlur: RealmNode<FocusEvent>;
|
|
119
121
|
}]) => {
|
|
120
122
|
currentListType: RealmNode<"" | ListType>;
|
|
121
123
|
applyListType: RealmNode<"" | ListType>;
|
|
@@ -173,6 +175,7 @@ listsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
173
175
|
applyBlockType: RealmNode<BlockType>;
|
|
174
176
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
175
177
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
178
|
+
onBlur: RealmNode<FocusEvent>;
|
|
176
179
|
}>], (r: Realm, [{ activeEditor, currentSelection }]: [{
|
|
177
180
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
178
181
|
inFocus: RealmNode<boolean>;
|
|
@@ -224,6 +227,7 @@ listsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
224
227
|
applyBlockType: RealmNode<BlockType>;
|
|
225
228
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
226
229
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
230
|
+
onBlur: RealmNode<FocusEvent>;
|
|
227
231
|
}]) => {
|
|
228
232
|
currentListType: RealmNode<"" | ListType>;
|
|
229
233
|
applyListType: RealmNode<"" | ListType>;
|
|
@@ -284,8 +288,9 @@ listsPluginHooks: {
|
|
|
284
288
|
applyBlockType: RealmNode<BlockType>;
|
|
285
289
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
286
290
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
291
|
+
onBlur: RealmNode<FocusEvent>;
|
|
287
292
|
}>;
|
|
288
|
-
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "currentListType" | "applyListType">(key: K, callback: (value: ValueForKey<{
|
|
293
|
+
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "currentListType" | "applyListType">(key: K, callback: (value: ValueForKey<{
|
|
289
294
|
currentListType: RealmNode<"" | ListType>;
|
|
290
295
|
applyListType: RealmNode<"" | ListType>;
|
|
291
296
|
} & {
|
|
@@ -339,6 +344,7 @@ listsPluginHooks: {
|
|
|
339
344
|
applyBlockType: RealmNode<BlockType>;
|
|
340
345
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
341
346
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
347
|
+
onBlur: RealmNode<FocusEvent>;
|
|
342
348
|
}, K>) => void) => void;
|
|
343
349
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
344
350
|
currentListType: RealmNode<"" | ListType>;
|
|
@@ -394,6 +400,7 @@ listsPluginHooks: {
|
|
|
394
400
|
applyBlockType: RealmNode<BlockType>;
|
|
395
401
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
396
402
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
403
|
+
onBlur: RealmNode<FocusEvent>;
|
|
397
404
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
398
405
|
currentListType: RealmNode<"" | ListType>;
|
|
399
406
|
applyListType: RealmNode<"" | ListType>;
|
|
@@ -448,6 +455,7 @@ listsPluginHooks: {
|
|
|
448
455
|
applyBlockType: RealmNode<BlockType>;
|
|
449
456
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
450
457
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
458
|
+
onBlur: RealmNode<FocusEvent>;
|
|
451
459
|
}, K_1>;
|
|
452
460
|
usePubKeys: () => (values: SystemDict<{
|
|
453
461
|
currentListType: RealmNode<"" | ListType>;
|
|
@@ -503,8 +511,9 @@ listsPluginHooks: {
|
|
|
503
511
|
applyBlockType: RealmNode<BlockType>;
|
|
504
512
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
505
513
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
514
|
+
onBlur: RealmNode<FocusEvent>;
|
|
506
515
|
}>) => void;
|
|
507
|
-
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "currentListType" | "applyListType">(key: K_2) => (value: ValueForKey<{
|
|
516
|
+
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "currentListType" | "applyListType">(key: K_2) => (value: ValueForKey<{
|
|
508
517
|
currentListType: RealmNode<"" | ListType>;
|
|
509
518
|
applyListType: RealmNode<"" | ListType>;
|
|
510
519
|
} & {
|
|
@@ -558,5 +567,6 @@ listsPluginHooks: {
|
|
|
558
567
|
applyBlockType: RealmNode<BlockType>;
|
|
559
568
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
560
569
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
570
|
+
onBlur: RealmNode<FocusEvent>;
|
|
561
571
|
}, K_2>) => void;
|
|
562
572
|
};
|
|
@@ -62,4 +62,5 @@ export declare const markdownShortcutPlugin: PluginConstructor<SystemSpec<[Syste
|
|
|
62
62
|
applyBlockType: RealmNode<BlockType>;
|
|
63
63
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
64
64
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
65
|
+
onBlur: RealmNode<FocusEvent>;
|
|
65
66
|
}>], (_: Realm) => {}>, object>;
|
|
@@ -64,6 +64,7 @@ quotePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
64
64
|
applyBlockType: RealmNode<BlockType>;
|
|
65
65
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
66
66
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
67
|
+
onBlur: RealmNode<FocusEvent>;
|
|
67
68
|
}>], () => {}>, object>,
|
|
68
69
|
/** @internal */
|
|
69
70
|
quotePluginHooks: {
|
|
@@ -118,8 +119,9 @@ quotePluginHooks: {
|
|
|
118
119
|
applyBlockType: RealmNode<BlockType>;
|
|
119
120
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
120
121
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
122
|
+
onBlur: RealmNode<FocusEvent>;
|
|
121
123
|
}>;
|
|
122
|
-
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode">(key: K, callback: (value: ValueForKey<{
|
|
124
|
+
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur">(key: K, callback: (value: ValueForKey<{
|
|
123
125
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
124
126
|
inFocus: RealmNode<boolean>;
|
|
125
127
|
historyState: RealmNode<HistoryState>;
|
|
@@ -170,6 +172,7 @@ quotePluginHooks: {
|
|
|
170
172
|
applyBlockType: RealmNode<BlockType>;
|
|
171
173
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
172
174
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
175
|
+
onBlur: RealmNode<FocusEvent>;
|
|
173
176
|
}, K>) => void) => void;
|
|
174
177
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
175
178
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -222,6 +225,7 @@ quotePluginHooks: {
|
|
|
222
225
|
applyBlockType: RealmNode<BlockType>;
|
|
223
226
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
224
227
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
228
|
+
onBlur: RealmNode<FocusEvent>;
|
|
225
229
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
226
230
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
227
231
|
inFocus: RealmNode<boolean>;
|
|
@@ -273,6 +277,7 @@ quotePluginHooks: {
|
|
|
273
277
|
applyBlockType: RealmNode<BlockType>;
|
|
274
278
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
275
279
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
280
|
+
onBlur: RealmNode<FocusEvent>;
|
|
276
281
|
}, K_1>;
|
|
277
282
|
usePubKeys: () => (values: SystemDict<{
|
|
278
283
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -325,8 +330,9 @@ quotePluginHooks: {
|
|
|
325
330
|
applyBlockType: RealmNode<BlockType>;
|
|
326
331
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
327
332
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
333
|
+
onBlur: RealmNode<FocusEvent>;
|
|
328
334
|
}>) => void;
|
|
329
|
-
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode">(key: K_2) => (value: ValueForKey<{
|
|
335
|
+
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur">(key: K_2) => (value: ValueForKey<{
|
|
330
336
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
331
337
|
inFocus: RealmNode<boolean>;
|
|
332
338
|
historyState: RealmNode<HistoryState>;
|
|
@@ -377,5 +383,6 @@ quotePluginHooks: {
|
|
|
377
383
|
applyBlockType: RealmNode<BlockType>;
|
|
378
384
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
379
385
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
386
|
+
onBlur: RealmNode<FocusEvent>;
|
|
380
387
|
}, K_2>) => void;
|
|
381
388
|
};
|
|
@@ -126,6 +126,7 @@ export declare const sandpackSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
126
126
|
applyBlockType: RealmNode<BlockType>;
|
|
127
127
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
128
128
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
129
|
+
onBlur: RealmNode<FocusEvent>;
|
|
129
130
|
}>, SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
130
131
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
131
132
|
inFocus: RealmNode<boolean>;
|
|
@@ -177,6 +178,7 @@ export declare const sandpackSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
177
178
|
applyBlockType: RealmNode<BlockType>;
|
|
178
179
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
179
180
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
181
|
+
onBlur: RealmNode<FocusEvent>;
|
|
180
182
|
}>], (r: Realm, [{ insertDecoratorNode }]: [{
|
|
181
183
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
182
184
|
inFocus: RealmNode<boolean>;
|
|
@@ -228,6 +230,7 @@ export declare const sandpackSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
228
230
|
applyBlockType: RealmNode<BlockType>;
|
|
229
231
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
230
232
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
233
|
+
onBlur: RealmNode<FocusEvent>;
|
|
231
234
|
}]) => {
|
|
232
235
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
233
236
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
@@ -284,6 +287,7 @@ export declare const sandpackSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
284
287
|
applyBlockType: RealmNode<BlockType>;
|
|
285
288
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
286
289
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
290
|
+
onBlur: RealmNode<FocusEvent>;
|
|
287
291
|
}, {
|
|
288
292
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
289
293
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
@@ -346,6 +350,7 @@ sandpackPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
346
350
|
applyBlockType: RealmNode<BlockType>;
|
|
347
351
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
348
352
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
353
|
+
onBlur: RealmNode<FocusEvent>;
|
|
349
354
|
}>, SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
350
355
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
351
356
|
inFocus: RealmNode<boolean>;
|
|
@@ -397,6 +402,7 @@ sandpackPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
397
402
|
applyBlockType: RealmNode<BlockType>;
|
|
398
403
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
399
404
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
405
|
+
onBlur: RealmNode<FocusEvent>;
|
|
400
406
|
}>], (r: Realm, [{ insertDecoratorNode }]: [{
|
|
401
407
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
402
408
|
inFocus: RealmNode<boolean>;
|
|
@@ -448,6 +454,7 @@ sandpackPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
448
454
|
applyBlockType: RealmNode<BlockType>;
|
|
449
455
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
450
456
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
457
|
+
onBlur: RealmNode<FocusEvent>;
|
|
451
458
|
}]) => {
|
|
452
459
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
453
460
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
@@ -504,6 +511,7 @@ sandpackPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
504
511
|
applyBlockType: RealmNode<BlockType>;
|
|
505
512
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
506
513
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
514
|
+
onBlur: RealmNode<FocusEvent>;
|
|
507
515
|
}, {
|
|
508
516
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
509
517
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
@@ -571,13 +579,14 @@ sandpackPluginHooks: {
|
|
|
571
579
|
applyBlockType: RealmNode<BlockType>;
|
|
572
580
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
573
581
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
582
|
+
onBlur: RealmNode<FocusEvent>;
|
|
574
583
|
} & {
|
|
575
584
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
576
585
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
577
586
|
appendCodeBlockEditorDescriptor: RealmNode<CodeBlockEditorDescriptor>;
|
|
578
587
|
insertCodeBlock: RealmNode<Partial<CreateCodeBlockNodeOptions>>;
|
|
579
588
|
}>;
|
|
580
|
-
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock" | "insertSandpack" | "sandpackConfig">(key: K, callback: (value: ValueForKey<{
|
|
589
|
+
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock" | "insertSandpack" | "sandpackConfig">(key: K, callback: (value: ValueForKey<{
|
|
581
590
|
insertSandpack: RealmNode<string>;
|
|
582
591
|
sandpackConfig: RealmNode<SandpackConfig>;
|
|
583
592
|
} & {
|
|
@@ -631,6 +640,7 @@ sandpackPluginHooks: {
|
|
|
631
640
|
applyBlockType: RealmNode<BlockType>;
|
|
632
641
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
633
642
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
643
|
+
onBlur: RealmNode<FocusEvent>;
|
|
634
644
|
} & {
|
|
635
645
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
636
646
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
@@ -691,6 +701,7 @@ sandpackPluginHooks: {
|
|
|
691
701
|
applyBlockType: RealmNode<BlockType>;
|
|
692
702
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
693
703
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
704
|
+
onBlur: RealmNode<FocusEvent>;
|
|
694
705
|
} & {
|
|
695
706
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
696
707
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
@@ -750,6 +761,7 @@ sandpackPluginHooks: {
|
|
|
750
761
|
applyBlockType: RealmNode<BlockType>;
|
|
751
762
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
752
763
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
764
|
+
onBlur: RealmNode<FocusEvent>;
|
|
753
765
|
} & {
|
|
754
766
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
755
767
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
@@ -810,13 +822,14 @@ sandpackPluginHooks: {
|
|
|
810
822
|
applyBlockType: RealmNode<BlockType>;
|
|
811
823
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
812
824
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
825
|
+
onBlur: RealmNode<FocusEvent>;
|
|
813
826
|
} & {
|
|
814
827
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
815
828
|
defaultCodeBlockLanguage: RealmNode<string>;
|
|
816
829
|
appendCodeBlockEditorDescriptor: RealmNode<CodeBlockEditorDescriptor>;
|
|
817
830
|
insertCodeBlock: RealmNode<Partial<CreateCodeBlockNodeOptions>>;
|
|
818
831
|
}>) => void;
|
|
819
|
-
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock" | "insertSandpack" | "sandpackConfig">(key: K_2) => (value: ValueForKey<{
|
|
832
|
+
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "codeBlockEditorDescriptors" | "defaultCodeBlockLanguage" | "appendCodeBlockEditorDescriptor" | "insertCodeBlock" | "insertSandpack" | "sandpackConfig">(key: K_2) => (value: ValueForKey<{
|
|
820
833
|
insertSandpack: RealmNode<string>;
|
|
821
834
|
sandpackConfig: RealmNode<SandpackConfig>;
|
|
822
835
|
} & {
|
|
@@ -870,6 +883,7 @@ sandpackPluginHooks: {
|
|
|
870
883
|
applyBlockType: RealmNode<BlockType>;
|
|
871
884
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
872
885
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
886
|
+
onBlur: RealmNode<FocusEvent>;
|
|
873
887
|
} & {
|
|
874
888
|
codeBlockEditorDescriptors: RealmNode<CodeBlockEditorDescriptor[]>;
|
|
875
889
|
defaultCodeBlockLanguage: RealmNode<string>;
|