@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
|
@@ -1,22 +1,25 @@
|
|
|
1
|
+
import * as Dialog from "@radix-ui/react-dialog";
|
|
1
2
|
import classNames from "classnames";
|
|
2
3
|
import YamlParser from "js-yaml";
|
|
3
4
|
import React__default from "react";
|
|
4
5
|
import { useForm, useFieldArray } from "react-hook-form";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
6
|
+
import { frontmatterPluginHooks } from "./index.js";
|
|
7
|
+
import CloseIcon from "../../icons/close.svg.js";
|
|
7
8
|
import DeleteIcon from "../../icons/delete.svg.js";
|
|
8
9
|
import styles from "../../styles/ui.module.css.js";
|
|
9
10
|
import { corePluginHooks } from "../core/index.js";
|
|
10
11
|
const FrontmatterEditor = ({ yaml, onChange }) => {
|
|
11
|
-
const [
|
|
12
|
-
const [
|
|
12
|
+
const [readOnly, editorRootElementRef] = corePluginHooks.useEmitterValues("readOnly", "editorRootElementRef");
|
|
13
|
+
const [frontmatterDialogOpen] = frontmatterPluginHooks.useEmitterValues("frontmatterDialogOpen");
|
|
14
|
+
const setFrontmatterDialogOpen = frontmatterPluginHooks.usePublisher("frontmatterDialogOpen");
|
|
15
|
+
const removeFrontmatter = frontmatterPluginHooks.usePublisher("removeFrontmatter");
|
|
13
16
|
const yamlConfig = React__default.useMemo(() => {
|
|
14
17
|
if (!yaml) {
|
|
15
18
|
return [];
|
|
16
19
|
}
|
|
17
20
|
return Object.entries(YamlParser.load(yaml)).map(([key, value]) => ({ key, value }));
|
|
18
21
|
}, [yaml]);
|
|
19
|
-
const { register, control,
|
|
22
|
+
const { register, control, handleSubmit } = useForm({
|
|
20
23
|
defaultValues: {
|
|
21
24
|
yamlConfig
|
|
22
25
|
}
|
|
@@ -25,8 +28,13 @@ const FrontmatterEditor = ({ yaml, onChange }) => {
|
|
|
25
28
|
control,
|
|
26
29
|
name: "yamlConfig"
|
|
27
30
|
});
|
|
28
|
-
React__default.
|
|
29
|
-
|
|
31
|
+
const onSubmit = React__default.useCallback(
|
|
32
|
+
({ yamlConfig: yamlConfig2 }) => {
|
|
33
|
+
if (yamlConfig2.length === 0) {
|
|
34
|
+
removeFrontmatter(true);
|
|
35
|
+
setFrontmatterDialogOpen(false);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
30
38
|
const yaml2 = yamlConfig2.reduce((acc, { key, value }) => {
|
|
31
39
|
if (key && value) {
|
|
32
40
|
acc[key] = value;
|
|
@@ -34,34 +42,24 @@ const FrontmatterEditor = ({ yaml, onChange }) => {
|
|
|
34
42
|
return acc;
|
|
35
43
|
}, {});
|
|
36
44
|
onChange(YamlParser.dump(yaml2).trim());
|
|
37
|
-
|
|
38
|
-
return () => subscription.unsubscribe();
|
|
39
|
-
}, [watch, onChange]);
|
|
40
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: styles.frontmatterWrapper, "data-expanded": expanded, "data-editor-type": "frontmatter" }, /* @__PURE__ */ React__default.createElement(
|
|
41
|
-
"button",
|
|
42
|
-
{
|
|
43
|
-
className: styles.frontmatterToggleButton,
|
|
44
|
-
onClick: (e) => {
|
|
45
|
-
e.preventDefault();
|
|
46
|
-
setExpanded((v) => !v);
|
|
47
|
-
}
|
|
45
|
+
setFrontmatterDialogOpen(false);
|
|
48
46
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
),
|
|
47
|
+
[onChange, setFrontmatterDialogOpen, removeFrontmatter]
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(Dialog.Root, { open: frontmatterDialogOpen, onOpenChange: (open) => setFrontmatterDialogOpen(open) }, /* @__PURE__ */ React__default.createElement(Dialog.Portal, { container: editorRootElementRef == null ? void 0 : editorRootElementRef.current }, /* @__PURE__ */ React__default.createElement(Dialog.Overlay, { className: styles.dialogOverlay }), /* @__PURE__ */ React__default.createElement(Dialog.Content, { className: styles.largeDialogContent, "data-editor-type": "frontmatter" }, /* @__PURE__ */ React__default.createElement(Dialog.Title, { className: styles.dialogTitle }, "Edit document frontmatter"), /* @__PURE__ */ React__default.createElement("form", { onSubmit: handleSubmit(onSubmit), onReset: () => setFrontmatterDialogOpen(false) }, /* @__PURE__ */ React__default.createElement("table", { className: styles.propertyEditorTable }, /* @__PURE__ */ React__default.createElement("colgroup", null, /* @__PURE__ */ React__default.createElement("col", null), /* @__PURE__ */ React__default.createElement("col", null), /* @__PURE__ */ React__default.createElement("col", null)), /* @__PURE__ */ React__default.createElement("thead", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("th", null, "Key"), /* @__PURE__ */ React__default.createElement("th", null, "Value"), /* @__PURE__ */ React__default.createElement("th", null))), /* @__PURE__ */ React__default.createElement("tbody", null, fields.map((item, index) => {
|
|
52
50
|
return /* @__PURE__ */ React__default.createElement("tr", { key: item.id }, /* @__PURE__ */ React__default.createElement("td", null, /* @__PURE__ */ React__default.createElement(TableInput, { ...register(`yamlConfig.${index}.key`, { required: true }), autofocusIfEmpty: true, readOnly })), /* @__PURE__ */ React__default.createElement("td", null, /* @__PURE__ */ React__default.createElement(TableInput, { ...register(`yamlConfig.${index}.value`, { required: true }), readOnly })), /* @__PURE__ */ React__default.createElement("td", null, /* @__PURE__ */ React__default.createElement("button", { type: "button", onClick: () => remove(index), className: styles.iconButton, disabled: readOnly }, /* @__PURE__ */ React__default.createElement(DeleteIcon, null))));
|
|
53
51
|
})), /* @__PURE__ */ React__default.createElement("tfoot", null, /* @__PURE__ */ React__default.createElement("tr", null, /* @__PURE__ */ React__default.createElement("td", null, /* @__PURE__ */ React__default.createElement(
|
|
54
52
|
"button",
|
|
55
53
|
{
|
|
56
54
|
disabled: readOnly,
|
|
57
|
-
className: styles.primaryButton,
|
|
55
|
+
className: classNames(styles.primaryButton, styles.smallButton),
|
|
58
56
|
type: "button",
|
|
59
57
|
onClick: () => {
|
|
60
58
|
append({ key: "", value: "" });
|
|
61
59
|
}
|
|
62
60
|
},
|
|
63
|
-
"Add
|
|
64
|
-
)))))));
|
|
61
|
+
"Add entry"
|
|
62
|
+
))))), /* @__PURE__ */ React__default.createElement("div", { style: { display: "flex", justifyContent: "flex-end", gap: "var(--spacing-2)" } }, /* @__PURE__ */ React__default.createElement("button", { type: "reset", className: styles.secondaryButton }, "Cancel"), /* @__PURE__ */ React__default.createElement("button", { type: "submit", className: styles.primaryButton }, "Save"))), /* @__PURE__ */ React__default.createElement(Dialog.Close, { asChild: true }, /* @__PURE__ */ React__default.createElement("button", { className: styles.dialogCloseButton, "aria-label": "Close" }, /* @__PURE__ */ React__default.createElement(CloseIcon, null)))))));
|
|
65
63
|
};
|
|
66
64
|
const TableInput = React__default.forwardRef(({ className, autofocusIfEmpty: _, ...props }, ref) => {
|
|
67
65
|
return /* @__PURE__ */ React__default.createElement("input", { className: classNames(styles.propertyEditorInput, className), ...props, ref });
|
|
@@ -63,7 +63,8 @@ export declare const frontmatterSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
63
63
|
applyBlockType: RealmNode<BlockType>;
|
|
64
64
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
65
65
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
66
|
-
|
|
66
|
+
onBlur: RealmNode<FocusEvent>;
|
|
67
|
+
}>], (r: Realm, [{ rootEditor, createRootEditorSubscription }]: [{
|
|
67
68
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
68
69
|
inFocus: RealmNode<boolean>;
|
|
69
70
|
historyState: RealmNode<HistoryState>;
|
|
@@ -114,8 +115,12 @@ export declare const frontmatterSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
114
115
|
applyBlockType: RealmNode<BlockType>;
|
|
115
116
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
116
117
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
118
|
+
onBlur: RealmNode<FocusEvent>;
|
|
117
119
|
}]) => {
|
|
118
120
|
insertFrontmatter: RealmNode<true>;
|
|
121
|
+
removeFrontmatter: RealmNode<true>;
|
|
122
|
+
hasFrontmatter: RealmNode<boolean>;
|
|
123
|
+
frontmatterDialogOpen: RealmNode<boolean>;
|
|
119
124
|
}>;
|
|
120
125
|
export declare const
|
|
121
126
|
/** @internal */
|
|
@@ -170,7 +175,8 @@ frontmatterPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
170
175
|
applyBlockType: RealmNode<BlockType>;
|
|
171
176
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
172
177
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
173
|
-
|
|
178
|
+
onBlur: RealmNode<FocusEvent>;
|
|
179
|
+
}>], (r: Realm, [{ rootEditor, createRootEditorSubscription }]: [{
|
|
174
180
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
175
181
|
inFocus: RealmNode<boolean>;
|
|
176
182
|
historyState: RealmNode<HistoryState>;
|
|
@@ -221,13 +227,20 @@ frontmatterPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
221
227
|
applyBlockType: RealmNode<BlockType>;
|
|
222
228
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
223
229
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
230
|
+
onBlur: RealmNode<FocusEvent>;
|
|
224
231
|
}]) => {
|
|
225
232
|
insertFrontmatter: RealmNode<true>;
|
|
233
|
+
removeFrontmatter: RealmNode<true>;
|
|
234
|
+
hasFrontmatter: RealmNode<boolean>;
|
|
235
|
+
frontmatterDialogOpen: RealmNode<boolean>;
|
|
226
236
|
}>, object>,
|
|
227
237
|
/** @internal */
|
|
228
238
|
frontmatterPluginHooks: {
|
|
229
239
|
useRealmContext: () => TypedRealm<{
|
|
230
240
|
insertFrontmatter: RealmNode<true>;
|
|
241
|
+
removeFrontmatter: RealmNode<true>;
|
|
242
|
+
hasFrontmatter: RealmNode<boolean>;
|
|
243
|
+
frontmatterDialogOpen: RealmNode<boolean>;
|
|
231
244
|
} & {
|
|
232
245
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
233
246
|
inFocus: RealmNode<boolean>;
|
|
@@ -279,9 +292,13 @@ frontmatterPluginHooks: {
|
|
|
279
292
|
applyBlockType: RealmNode<BlockType>;
|
|
280
293
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
281
294
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
295
|
+
onBlur: RealmNode<FocusEvent>;
|
|
282
296
|
}>;
|
|
283
|
-
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" | "insertFrontmatter">(key: K, callback: (value: ValueForKey<{
|
|
297
|
+
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" | "insertFrontmatter" | "removeFrontmatter" | "hasFrontmatter" | "frontmatterDialogOpen">(key: K, callback: (value: ValueForKey<{
|
|
284
298
|
insertFrontmatter: RealmNode<true>;
|
|
299
|
+
removeFrontmatter: RealmNode<true>;
|
|
300
|
+
hasFrontmatter: RealmNode<boolean>;
|
|
301
|
+
frontmatterDialogOpen: RealmNode<boolean>;
|
|
285
302
|
} & {
|
|
286
303
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
287
304
|
inFocus: RealmNode<boolean>;
|
|
@@ -333,9 +350,13 @@ frontmatterPluginHooks: {
|
|
|
333
350
|
applyBlockType: RealmNode<BlockType>;
|
|
334
351
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
335
352
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
353
|
+
onBlur: RealmNode<FocusEvent>;
|
|
336
354
|
}, K>) => void) => void;
|
|
337
355
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
338
356
|
insertFrontmatter: RealmNode<true>;
|
|
357
|
+
removeFrontmatter: RealmNode<true>;
|
|
358
|
+
hasFrontmatter: RealmNode<boolean>;
|
|
359
|
+
frontmatterDialogOpen: RealmNode<boolean>;
|
|
339
360
|
} & {
|
|
340
361
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
341
362
|
inFocus: RealmNode<boolean>;
|
|
@@ -387,8 +408,12 @@ frontmatterPluginHooks: {
|
|
|
387
408
|
applyBlockType: RealmNode<BlockType>;
|
|
388
409
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
389
410
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
411
|
+
onBlur: RealmNode<FocusEvent>;
|
|
390
412
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
391
413
|
insertFrontmatter: RealmNode<true>;
|
|
414
|
+
removeFrontmatter: RealmNode<true>;
|
|
415
|
+
hasFrontmatter: RealmNode<boolean>;
|
|
416
|
+
frontmatterDialogOpen: RealmNode<boolean>;
|
|
392
417
|
} & {
|
|
393
418
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
394
419
|
inFocus: RealmNode<boolean>;
|
|
@@ -440,9 +465,13 @@ frontmatterPluginHooks: {
|
|
|
440
465
|
applyBlockType: RealmNode<BlockType>;
|
|
441
466
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
442
467
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
468
|
+
onBlur: RealmNode<FocusEvent>;
|
|
443
469
|
}, K_1>;
|
|
444
470
|
usePubKeys: () => (values: SystemDict<{
|
|
445
471
|
insertFrontmatter: RealmNode<true>;
|
|
472
|
+
removeFrontmatter: RealmNode<true>;
|
|
473
|
+
hasFrontmatter: RealmNode<boolean>;
|
|
474
|
+
frontmatterDialogOpen: RealmNode<boolean>;
|
|
446
475
|
} & {
|
|
447
476
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
448
477
|
inFocus: RealmNode<boolean>;
|
|
@@ -494,9 +523,13 @@ frontmatterPluginHooks: {
|
|
|
494
523
|
applyBlockType: RealmNode<BlockType>;
|
|
495
524
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
496
525
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
526
|
+
onBlur: RealmNode<FocusEvent>;
|
|
497
527
|
}>) => void;
|
|
498
|
-
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" | "insertFrontmatter">(key: K_2) => (value: ValueForKey<{
|
|
528
|
+
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" | "insertFrontmatter" | "removeFrontmatter" | "hasFrontmatter" | "frontmatterDialogOpen">(key: K_2) => (value: ValueForKey<{
|
|
499
529
|
insertFrontmatter: RealmNode<true>;
|
|
530
|
+
removeFrontmatter: RealmNode<true>;
|
|
531
|
+
hasFrontmatter: RealmNode<boolean>;
|
|
532
|
+
frontmatterDialogOpen: RealmNode<boolean>;
|
|
500
533
|
} & {
|
|
501
534
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
502
535
|
inFocus: RealmNode<boolean>;
|
|
@@ -548,5 +581,6 @@ frontmatterPluginHooks: {
|
|
|
548
581
|
applyBlockType: RealmNode<BlockType>;
|
|
549
582
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
550
583
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
584
|
+
onBlur: RealmNode<FocusEvent>;
|
|
551
585
|
}, K_2>) => void;
|
|
552
586
|
};
|
|
@@ -8,8 +8,11 @@ import { $isFrontmatterNode, $createFrontmatterNode, FrontmatterNode } from "./F
|
|
|
8
8
|
import { system } from "../../gurx/realmFactory.js";
|
|
9
9
|
import { realmPlugin } from "../../gurx/react.js";
|
|
10
10
|
const frontmatterSystem = system(
|
|
11
|
-
(r, [{ rootEditor }]) => {
|
|
11
|
+
(r, [{ rootEditor, createRootEditorSubscription }]) => {
|
|
12
12
|
const insertFrontmatter = r.node();
|
|
13
|
+
const removeFrontmatter = r.node();
|
|
14
|
+
const frontmatterDialogOpen = r.node(false);
|
|
15
|
+
const hasFrontmatter = r.node(false);
|
|
13
16
|
r.sub(r.pipe(insertFrontmatter, r.o.withLatestFrom(rootEditor)), ([, theEditor]) => {
|
|
14
17
|
theEditor == null ? void 0 : theEditor.update(() => {
|
|
15
18
|
const firstItem = $getRoot().getFirstChild();
|
|
@@ -22,9 +25,29 @@ const frontmatterSystem = system(
|
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
});
|
|
28
|
+
r.pub(frontmatterDialogOpen, true);
|
|
29
|
+
});
|
|
30
|
+
r.sub(r.pipe(removeFrontmatter, r.o.withLatestFrom(rootEditor)), ([, theEditor]) => {
|
|
31
|
+
theEditor == null ? void 0 : theEditor.update(() => {
|
|
32
|
+
const firstItem = $getRoot().getFirstChild();
|
|
33
|
+
if ($isFrontmatterNode(firstItem)) {
|
|
34
|
+
firstItem.remove();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
r.pub(frontmatterDialogOpen, false);
|
|
38
|
+
});
|
|
39
|
+
r.pub(createRootEditorSubscription, (rootEditor2) => {
|
|
40
|
+
return rootEditor2.registerUpdateListener(({ editorState }) => {
|
|
41
|
+
editorState.read(() => {
|
|
42
|
+
r.pub(hasFrontmatter, $isFrontmatterNode($getRoot().getFirstChild()));
|
|
43
|
+
});
|
|
44
|
+
});
|
|
25
45
|
});
|
|
26
46
|
return {
|
|
27
|
-
insertFrontmatter
|
|
47
|
+
insertFrontmatter,
|
|
48
|
+
removeFrontmatter,
|
|
49
|
+
hasFrontmatter,
|
|
50
|
+
frontmatterDialogOpen
|
|
28
51
|
};
|
|
29
52
|
},
|
|
30
53
|
[coreSystem]
|
|
@@ -67,6 +67,7 @@ export declare const headingsSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
67
67
|
applyBlockType: RealmNode<BlockType>;
|
|
68
68
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
69
69
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
70
|
+
onBlur: RealmNode<FocusEvent>;
|
|
70
71
|
}>], (r: Realm, [{ createRootEditorSubscription, convertSelectionToNode }]: [{
|
|
71
72
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
72
73
|
inFocus: RealmNode<boolean>;
|
|
@@ -118,6 +119,7 @@ export declare const headingsSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
118
119
|
applyBlockType: RealmNode<BlockType>;
|
|
119
120
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
120
121
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
122
|
+
onBlur: RealmNode<FocusEvent>;
|
|
121
123
|
}]) => {
|
|
122
124
|
allowedHeadingLevels: RealmNode<readonly (1 | 2 | 4 | 3 | 5 | 6)[]>;
|
|
123
125
|
}>;
|
|
@@ -185,6 +187,7 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
|
|
|
185
187
|
applyBlockType: RealmNode<BlockType>;
|
|
186
188
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
187
189
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
190
|
+
onBlur: RealmNode<FocusEvent>;
|
|
188
191
|
}>], (r: Realm, [{ createRootEditorSubscription, convertSelectionToNode }]: [{
|
|
189
192
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
190
193
|
inFocus: RealmNode<boolean>;
|
|
@@ -236,6 +239,7 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
|
|
|
236
239
|
applyBlockType: RealmNode<BlockType>;
|
|
237
240
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
238
241
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
242
|
+
onBlur: RealmNode<FocusEvent>;
|
|
239
243
|
}]) => {
|
|
240
244
|
allowedHeadingLevels: RealmNode<readonly (1 | 2 | 4 | 3 | 5 | 6)[]>;
|
|
241
245
|
}>, HeadingsPluginParams>, headingsPluginHooks: {
|
|
@@ -292,8 +296,9 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
|
|
|
292
296
|
applyBlockType: RealmNode<BlockType>;
|
|
293
297
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
294
298
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
299
|
+
onBlur: RealmNode<FocusEvent>;
|
|
295
300
|
}>;
|
|
296
|
-
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" | "allowedHeadingLevels">(key: K, callback: (value: ValueForKey<{
|
|
301
|
+
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" | "allowedHeadingLevels">(key: K, callback: (value: ValueForKey<{
|
|
297
302
|
allowedHeadingLevels: RealmNode<readonly (1 | 2 | 4 | 3 | 5 | 6)[]>;
|
|
298
303
|
} & {
|
|
299
304
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -346,6 +351,7 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
|
|
|
346
351
|
applyBlockType: RealmNode<BlockType>;
|
|
347
352
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
348
353
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
354
|
+
onBlur: RealmNode<FocusEvent>;
|
|
349
355
|
}, K>) => void) => void;
|
|
350
356
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
351
357
|
allowedHeadingLevels: RealmNode<readonly (1 | 2 | 4 | 3 | 5 | 6)[]>;
|
|
@@ -400,6 +406,7 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
|
|
|
400
406
|
applyBlockType: RealmNode<BlockType>;
|
|
401
407
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
402
408
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
409
|
+
onBlur: RealmNode<FocusEvent>;
|
|
403
410
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
404
411
|
allowedHeadingLevels: RealmNode<readonly (1 | 2 | 4 | 3 | 5 | 6)[]>;
|
|
405
412
|
} & {
|
|
@@ -453,6 +460,7 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
|
|
|
453
460
|
applyBlockType: RealmNode<BlockType>;
|
|
454
461
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
455
462
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
463
|
+
onBlur: RealmNode<FocusEvent>;
|
|
456
464
|
}, K_1>;
|
|
457
465
|
usePubKeys: () => (values: SystemDict<{
|
|
458
466
|
allowedHeadingLevels: RealmNode<readonly (1 | 2 | 4 | 3 | 5 | 6)[]>;
|
|
@@ -507,8 +515,9 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
|
|
|
507
515
|
applyBlockType: RealmNode<BlockType>;
|
|
508
516
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
509
517
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
518
|
+
onBlur: RealmNode<FocusEvent>;
|
|
510
519
|
}>) => void;
|
|
511
|
-
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" | "allowedHeadingLevels">(key: K_2) => (value: ValueForKey<{
|
|
520
|
+
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" | "allowedHeadingLevels">(key: K_2) => (value: ValueForKey<{
|
|
512
521
|
allowedHeadingLevels: RealmNode<readonly (1 | 2 | 4 | 3 | 5 | 6)[]>;
|
|
513
522
|
} & {
|
|
514
523
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -561,6 +570,7 @@ export declare const headingsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[]
|
|
|
561
570
|
applyBlockType: RealmNode<BlockType>;
|
|
562
571
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
563
572
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
573
|
+
onBlur: RealmNode<FocusEvent>;
|
|
564
574
|
}, K_2>) => void;
|
|
565
575
|
};
|
|
566
576
|
export {};
|
|
@@ -66,6 +66,7 @@ export declare const imageSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
66
66
|
applyBlockType: RealmNode<BlockType>;
|
|
67
67
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
68
68
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
69
|
+
onBlur: RealmNode<FocusEvent>;
|
|
69
70
|
}>], (r: Realm, [{ rootEditor }]: [{
|
|
70
71
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
71
72
|
inFocus: RealmNode<boolean>;
|
|
@@ -117,6 +118,7 @@ export declare const imageSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
117
118
|
applyBlockType: RealmNode<BlockType>;
|
|
118
119
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
119
120
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
121
|
+
onBlur: RealmNode<FocusEvent>;
|
|
120
122
|
}]) => {
|
|
121
123
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
122
124
|
imageAutocompleteSuggestions: RealmNode<string[]>;
|
|
@@ -181,6 +183,7 @@ imagePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
181
183
|
applyBlockType: RealmNode<BlockType>;
|
|
182
184
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
183
185
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
186
|
+
onBlur: RealmNode<FocusEvent>;
|
|
184
187
|
}>], (r: Realm, [{ rootEditor }]: [{
|
|
185
188
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
186
189
|
inFocus: RealmNode<boolean>;
|
|
@@ -232,6 +235,7 @@ imagePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
232
235
|
applyBlockType: RealmNode<BlockType>;
|
|
233
236
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
234
237
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
238
|
+
onBlur: RealmNode<FocusEvent>;
|
|
235
239
|
}]) => {
|
|
236
240
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
237
241
|
imageAutocompleteSuggestions: RealmNode<string[]>;
|
|
@@ -296,8 +300,9 @@ imagePluginHooks: {
|
|
|
296
300
|
applyBlockType: RealmNode<BlockType>;
|
|
297
301
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
298
302
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
303
|
+
onBlur: RealmNode<FocusEvent>;
|
|
299
304
|
}>;
|
|
300
|
-
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" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "disableImageResize" | "insertImage">(key: K, callback: (value: ValueForKey<{
|
|
305
|
+
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" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "disableImageResize" | "insertImage">(key: K, callback: (value: ValueForKey<{
|
|
301
306
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
302
307
|
imageAutocompleteSuggestions: RealmNode<string[]>;
|
|
303
308
|
disableImageResize: RealmNode<boolean>;
|
|
@@ -353,6 +358,7 @@ imagePluginHooks: {
|
|
|
353
358
|
applyBlockType: RealmNode<BlockType>;
|
|
354
359
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
355
360
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
361
|
+
onBlur: RealmNode<FocusEvent>;
|
|
356
362
|
}, K>) => void) => void;
|
|
357
363
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
358
364
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
@@ -410,6 +416,7 @@ imagePluginHooks: {
|
|
|
410
416
|
applyBlockType: RealmNode<BlockType>;
|
|
411
417
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
412
418
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
419
|
+
onBlur: RealmNode<FocusEvent>;
|
|
413
420
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
414
421
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
415
422
|
imageAutocompleteSuggestions: RealmNode<string[]>;
|
|
@@ -466,6 +473,7 @@ imagePluginHooks: {
|
|
|
466
473
|
applyBlockType: RealmNode<BlockType>;
|
|
467
474
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
468
475
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
476
|
+
onBlur: RealmNode<FocusEvent>;
|
|
469
477
|
}, K_1>;
|
|
470
478
|
usePubKeys: () => (values: SystemDict<{
|
|
471
479
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
@@ -523,8 +531,9 @@ imagePluginHooks: {
|
|
|
523
531
|
applyBlockType: RealmNode<BlockType>;
|
|
524
532
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
525
533
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
534
|
+
onBlur: RealmNode<FocusEvent>;
|
|
526
535
|
}>) => void;
|
|
527
|
-
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" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "disableImageResize" | "insertImage">(key: K_2) => (value: ValueForKey<{
|
|
536
|
+
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" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "disableImageResize" | "insertImage">(key: K_2) => (value: ValueForKey<{
|
|
528
537
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
529
538
|
imageAutocompleteSuggestions: RealmNode<string[]>;
|
|
530
539
|
disableImageResize: RealmNode<boolean>;
|
|
@@ -580,6 +589,7 @@ imagePluginHooks: {
|
|
|
580
589
|
applyBlockType: RealmNode<BlockType>;
|
|
581
590
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
582
591
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
592
|
+
onBlur: RealmNode<FocusEvent>;
|
|
583
593
|
}, K_2>) => void;
|
|
584
594
|
};
|
|
585
595
|
/** @internal */
|
|
@@ -130,6 +130,7 @@ export declare const jsxSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
130
130
|
applyBlockType: RealmNode<BlockType>;
|
|
131
131
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
132
132
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
133
|
+
onBlur: RealmNode<FocusEvent>;
|
|
133
134
|
}>], (r: Realm, [{ insertDecoratorNode }]: [{
|
|
134
135
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
135
136
|
inFocus: RealmNode<boolean>;
|
|
@@ -181,6 +182,7 @@ export declare const jsxSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
181
182
|
applyBlockType: RealmNode<BlockType>;
|
|
182
183
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
183
184
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
185
|
+
onBlur: RealmNode<FocusEvent>;
|
|
184
186
|
}]) => {
|
|
185
187
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
186
188
|
}>;
|
|
@@ -246,6 +248,7 @@ jsxPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
246
248
|
applyBlockType: RealmNode<BlockType>;
|
|
247
249
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
248
250
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
251
|
+
onBlur: RealmNode<FocusEvent>;
|
|
249
252
|
}>], (r: Realm, [{ insertDecoratorNode }]: [{
|
|
250
253
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
251
254
|
inFocus: RealmNode<boolean>;
|
|
@@ -297,6 +300,7 @@ jsxPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
297
300
|
applyBlockType: RealmNode<BlockType>;
|
|
298
301
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
299
302
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
303
|
+
onBlur: RealmNode<FocusEvent>;
|
|
300
304
|
}]) => {
|
|
301
305
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
302
306
|
}>, JsxPluginParams>,
|
|
@@ -355,8 +359,9 @@ jsxPluginHooks: {
|
|
|
355
359
|
applyBlockType: RealmNode<BlockType>;
|
|
356
360
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
357
361
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
362
|
+
onBlur: RealmNode<FocusEvent>;
|
|
358
363
|
}>;
|
|
359
|
-
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" | "insertJsx">(key: K, callback: (value: ValueForKey<{
|
|
364
|
+
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" | "insertJsx">(key: K, callback: (value: ValueForKey<{
|
|
360
365
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
361
366
|
} & {
|
|
362
367
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -409,6 +414,7 @@ jsxPluginHooks: {
|
|
|
409
414
|
applyBlockType: RealmNode<BlockType>;
|
|
410
415
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
411
416
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
417
|
+
onBlur: RealmNode<FocusEvent>;
|
|
412
418
|
}, K>) => void) => void;
|
|
413
419
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
414
420
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
@@ -463,6 +469,7 @@ jsxPluginHooks: {
|
|
|
463
469
|
applyBlockType: RealmNode<BlockType>;
|
|
464
470
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
465
471
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
472
|
+
onBlur: RealmNode<FocusEvent>;
|
|
466
473
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
467
474
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
468
475
|
} & {
|
|
@@ -516,6 +523,7 @@ jsxPluginHooks: {
|
|
|
516
523
|
applyBlockType: RealmNode<BlockType>;
|
|
517
524
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
518
525
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
526
|
+
onBlur: RealmNode<FocusEvent>;
|
|
519
527
|
}, K_1>;
|
|
520
528
|
usePubKeys: () => (values: SystemDict<{
|
|
521
529
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
@@ -570,8 +578,9 @@ jsxPluginHooks: {
|
|
|
570
578
|
applyBlockType: RealmNode<BlockType>;
|
|
571
579
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
572
580
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
581
|
+
onBlur: RealmNode<FocusEvent>;
|
|
573
582
|
}>) => void;
|
|
574
|
-
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" | "insertJsx">(key: K_2) => (value: ValueForKey<{
|
|
583
|
+
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" | "insertJsx">(key: K_2) => (value: ValueForKey<{
|
|
575
584
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
576
585
|
} & {
|
|
577
586
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -624,6 +633,7 @@ jsxPluginHooks: {
|
|
|
624
633
|
applyBlockType: RealmNode<BlockType>;
|
|
625
634
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
626
635
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
636
|
+
onBlur: RealmNode<FocusEvent>;
|
|
627
637
|
}, K_2>) => void;
|
|
628
638
|
};
|
|
629
639
|
export {};
|
|
@@ -80,6 +80,7 @@ export declare const linkPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r
|
|
|
80
80
|
applyBlockType: RealmNode<BlockType>;
|
|
81
81
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
82
82
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
83
|
+
onBlur: RealmNode<FocusEvent>;
|
|
83
84
|
}>], (r: Realm) => {
|
|
84
85
|
disableAutoLink: RealmNode<boolean>;
|
|
85
86
|
}>, LinkPluginParams>;
|
|
@@ -3,10 +3,11 @@ import { LexicalCommand } from 'lexical';
|
|
|
3
3
|
export declare const OPEN_LINK_DIALOG: LexicalCommand<undefined>;
|
|
4
4
|
interface LinkEditFormProps {
|
|
5
5
|
initialUrl: string;
|
|
6
|
-
|
|
6
|
+
initialTitle: string;
|
|
7
|
+
onSubmit: (link: [string, string]) => void;
|
|
7
8
|
onCancel: () => void;
|
|
8
9
|
linkAutocompleteSuggestions: string[];
|
|
9
10
|
}
|
|
10
|
-
export declare function LinkEditForm({ initialUrl, onSubmit, onCancel, linkAutocompleteSuggestions }: LinkEditFormProps): React.JSX.Element;
|
|
11
|
+
export declare function LinkEditForm({ initialUrl, initialTitle, onSubmit, onCancel, linkAutocompleteSuggestions }: LinkEditFormProps): React.JSX.Element;
|
|
11
12
|
export declare const LinkDialog: React.FC;
|
|
12
13
|
export {};
|