@mdxeditor/editor 0.15.2 → 0.17.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 -0
- package/dist/MDXEditor.js +8 -2
- package/dist/gurx/react.js +1 -1
- package/dist/index.js +2 -1
- package/dist/plugins/codeblock/index.d.ts +12 -2
- package/dist/plugins/codemirror/CodeMirrorEditor.js +6 -3
- package/dist/plugins/codemirror/index.d.ts +16 -2
- package/dist/plugins/core/index.d.ts +11 -2
- package/dist/plugins/core/index.js +12 -4
- package/dist/plugins/diff-source/SourceEditor.js +2 -1
- 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 +4 -1
- package/dist/plugins/frontmatter/index.d.ts +12 -2
- package/dist/plugins/headings/index.d.ts +348 -3
- package/dist/plugins/headings/index.js +22 -10
- 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/index.d.ts +10 -2
- package/dist/plugins/lists/index.d.ts +12 -2
- package/dist/plugins/markdown-shortcut/index.d.ts +2 -1
- package/dist/plugins/markdown-shortcut/index.js +35 -3
- package/dist/plugins/quote/index.d.ts +9 -2
- package/dist/plugins/sandpack/SandpackEditor.js +3 -1
- 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/BlockTypeSelect.js +3 -1
- package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.js +1 -1
- package/dist/plugins/toolbar/index.d.ts +10 -2
- package/dist/plugins/toolbar/index.js +3 -2
- package/dist/plugins/toolbar/primitives/DialogButton.js +2 -2
- package/dist/plugins/toolbar/primitives/select.js +14 -2
- package/dist/plugins/toolbar/primitives/toolbar.d.ts +4 -1
- package/dist/plugins/toolbar/primitives/toolbar.js +12 -8
- package/dist/style.css +211 -169
- package/dist/styles/ui.module.css.js +88 -85
- package/package.json +1 -1
|
@@ -7,16 +7,18 @@ import { controlOrMeta } from "../../utils/detectMac.js";
|
|
|
7
7
|
import { system } from "../../gurx/realmFactory.js";
|
|
8
8
|
import { realmPlugin } from "../../gurx/react.js";
|
|
9
9
|
const FORMATTING_KEYS = [48, 49, 50, 51, 52, 53, 54];
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
const ALL_HEADING_LEVELS = [1, 2, 3, 4, 5, 6];
|
|
11
|
+
const CODE_TO_HEADING_LEVEL_MAP = {
|
|
12
|
+
49: 1,
|
|
13
|
+
50: 2,
|
|
14
|
+
51: 3,
|
|
15
|
+
52: 4,
|
|
16
|
+
53: 5,
|
|
17
|
+
54: 6
|
|
17
18
|
};
|
|
18
19
|
const headingsSystem = system(
|
|
19
20
|
(r, [{ createRootEditorSubscription, convertSelectionToNode }]) => {
|
|
21
|
+
const allowedHeadingLevels = r.node(ALL_HEADING_LEVELS);
|
|
20
22
|
r.pub(createRootEditorSubscription, (theRootEditor) => {
|
|
21
23
|
return theRootEditor.registerCommand(
|
|
22
24
|
KEY_DOWN_COMMAND,
|
|
@@ -28,7 +30,11 @@ const headingsSystem = system(
|
|
|
28
30
|
if (keyCode === 48) {
|
|
29
31
|
r.pub(convertSelectionToNode, () => $createParagraphNode());
|
|
30
32
|
} else {
|
|
31
|
-
|
|
33
|
+
const allowedHeadingLevelsValues = r.getValue(allowedHeadingLevels);
|
|
34
|
+
const requestedHeadingLevel = CODE_TO_HEADING_LEVEL_MAP[keyCode];
|
|
35
|
+
if (!allowedHeadingLevelsValues.includes(requestedHeadingLevel)) {
|
|
36
|
+
r.pub(convertSelectionToNode, () => $createHeadingNode(`h${requestedHeadingLevel}`));
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
});
|
|
34
40
|
return true;
|
|
@@ -38,13 +44,18 @@ const headingsSystem = system(
|
|
|
38
44
|
COMMAND_PRIORITY_LOW
|
|
39
45
|
);
|
|
40
46
|
});
|
|
41
|
-
return {
|
|
47
|
+
return {
|
|
48
|
+
allowedHeadingLevels
|
|
49
|
+
};
|
|
42
50
|
},
|
|
43
51
|
[coreSystem]
|
|
44
52
|
);
|
|
45
|
-
const [headingsPlugin] = realmPlugin({
|
|
53
|
+
const [headingsPlugin, headingsPluginHooks] = realmPlugin({
|
|
46
54
|
id: "headings",
|
|
47
55
|
systemSpec: headingsSystem,
|
|
56
|
+
applyParamsToSystem(realm, params) {
|
|
57
|
+
realm.pubKey("allowedHeadingLevels", (params == null ? void 0 : params.allowedHeadingLevels) ?? ALL_HEADING_LEVELS);
|
|
58
|
+
},
|
|
48
59
|
init: (realm) => {
|
|
49
60
|
realm.pubKey("addImportVisitor", MdastHeadingVisitor);
|
|
50
61
|
realm.pubKey("addLexicalNode", HeadingNode);
|
|
@@ -53,5 +64,6 @@ const [headingsPlugin] = realmPlugin({
|
|
|
53
64
|
});
|
|
54
65
|
export {
|
|
55
66
|
headingsPlugin,
|
|
67
|
+
headingsPluginHooks,
|
|
56
68
|
headingsSystem
|
|
57
69
|
};
|
|
@@ -46,6 +46,7 @@ export declare const imageSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
46
46
|
contentEditableClassName: RealmNode<string>;
|
|
47
47
|
placeholder: RealmNode<ReactNode>;
|
|
48
48
|
autoFocus: RealmNode<boolean>;
|
|
49
|
+
readOnly: RealmNode<boolean>;
|
|
49
50
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
50
51
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
51
52
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -96,6 +97,7 @@ export declare const imageSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
96
97
|
contentEditableClassName: RealmNode<string>;
|
|
97
98
|
placeholder: RealmNode<ReactNode>;
|
|
98
99
|
autoFocus: RealmNode<boolean>;
|
|
100
|
+
readOnly: RealmNode<boolean>;
|
|
99
101
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
100
102
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
101
103
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -159,6 +161,7 @@ imagePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
159
161
|
contentEditableClassName: RealmNode<string>;
|
|
160
162
|
placeholder: RealmNode<ReactNode>;
|
|
161
163
|
autoFocus: RealmNode<boolean>;
|
|
164
|
+
readOnly: RealmNode<boolean>;
|
|
162
165
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
163
166
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
164
167
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -209,6 +212,7 @@ imagePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
209
212
|
contentEditableClassName: RealmNode<string>;
|
|
210
213
|
placeholder: RealmNode<ReactNode>;
|
|
211
214
|
autoFocus: RealmNode<boolean>;
|
|
215
|
+
readOnly: RealmNode<boolean>;
|
|
212
216
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
213
217
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
214
218
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -272,6 +276,7 @@ imagePluginHooks: {
|
|
|
272
276
|
contentEditableClassName: RealmNode<string>;
|
|
273
277
|
placeholder: RealmNode<ReactNode>;
|
|
274
278
|
autoFocus: RealmNode<boolean>;
|
|
279
|
+
readOnly: RealmNode<boolean>;
|
|
275
280
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
276
281
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
277
282
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -292,7 +297,7 @@ imagePluginHooks: {
|
|
|
292
297
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
293
298
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
294
299
|
}>;
|
|
295
|
-
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" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "disableImageResize" | "insertImage">(key: K, callback: (value: ValueForKey<{
|
|
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<{
|
|
296
301
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
297
302
|
imageAutocompleteSuggestions: RealmNode<string[]>;
|
|
298
303
|
disableImageResize: RealmNode<boolean>;
|
|
@@ -328,6 +333,7 @@ imagePluginHooks: {
|
|
|
328
333
|
contentEditableClassName: RealmNode<string>;
|
|
329
334
|
placeholder: RealmNode<ReactNode>;
|
|
330
335
|
autoFocus: RealmNode<boolean>;
|
|
336
|
+
readOnly: RealmNode<boolean>;
|
|
331
337
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
332
338
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
333
339
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -384,6 +390,7 @@ imagePluginHooks: {
|
|
|
384
390
|
contentEditableClassName: RealmNode<string>;
|
|
385
391
|
placeholder: RealmNode<ReactNode>;
|
|
386
392
|
autoFocus: RealmNode<boolean>;
|
|
393
|
+
readOnly: RealmNode<boolean>;
|
|
387
394
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
388
395
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
389
396
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -439,6 +446,7 @@ imagePluginHooks: {
|
|
|
439
446
|
contentEditableClassName: RealmNode<string>;
|
|
440
447
|
placeholder: RealmNode<ReactNode>;
|
|
441
448
|
autoFocus: RealmNode<boolean>;
|
|
449
|
+
readOnly: RealmNode<boolean>;
|
|
442
450
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
443
451
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
444
452
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -495,6 +503,7 @@ imagePluginHooks: {
|
|
|
495
503
|
contentEditableClassName: RealmNode<string>;
|
|
496
504
|
placeholder: RealmNode<ReactNode>;
|
|
497
505
|
autoFocus: RealmNode<boolean>;
|
|
506
|
+
readOnly: RealmNode<boolean>;
|
|
498
507
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
499
508
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
500
509
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -515,7 +524,7 @@ imagePluginHooks: {
|
|
|
515
524
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
516
525
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
517
526
|
}>) => void;
|
|
518
|
-
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" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "imageUploadHandler" | "imageAutocompleteSuggestions" | "disableImageResize" | "insertImage">(key: K_2) => (value: ValueForKey<{
|
|
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<{
|
|
519
528
|
imageUploadHandler: RealmNode<ImageUploadHandler>;
|
|
520
529
|
imageAutocompleteSuggestions: RealmNode<string[]>;
|
|
521
530
|
disableImageResize: RealmNode<boolean>;
|
|
@@ -551,6 +560,7 @@ imagePluginHooks: {
|
|
|
551
560
|
contentEditableClassName: RealmNode<string>;
|
|
552
561
|
placeholder: RealmNode<ReactNode>;
|
|
553
562
|
autoFocus: RealmNode<boolean>;
|
|
563
|
+
readOnly: RealmNode<boolean>;
|
|
554
564
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
555
565
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
556
566
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -109,6 +109,7 @@ export declare const jsxSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
109
109
|
contentEditableClassName: RealmNode<string>;
|
|
110
110
|
placeholder: RealmNode<React.ReactNode>;
|
|
111
111
|
autoFocus: RealmNode<boolean>;
|
|
112
|
+
readOnly: RealmNode<boolean>;
|
|
112
113
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
113
114
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
114
115
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -159,6 +160,7 @@ export declare const jsxSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
159
160
|
contentEditableClassName: RealmNode<string>;
|
|
160
161
|
placeholder: RealmNode<React.ReactNode>;
|
|
161
162
|
autoFocus: RealmNode<boolean>;
|
|
163
|
+
readOnly: RealmNode<boolean>;
|
|
162
164
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
163
165
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
164
166
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -223,6 +225,7 @@ jsxPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
223
225
|
contentEditableClassName: RealmNode<string>;
|
|
224
226
|
placeholder: RealmNode<React.ReactNode>;
|
|
225
227
|
autoFocus: RealmNode<boolean>;
|
|
228
|
+
readOnly: RealmNode<boolean>;
|
|
226
229
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
227
230
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
228
231
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -273,6 +276,7 @@ jsxPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
273
276
|
contentEditableClassName: RealmNode<string>;
|
|
274
277
|
placeholder: RealmNode<React.ReactNode>;
|
|
275
278
|
autoFocus: RealmNode<boolean>;
|
|
279
|
+
readOnly: RealmNode<boolean>;
|
|
276
280
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
277
281
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
278
282
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -330,6 +334,7 @@ jsxPluginHooks: {
|
|
|
330
334
|
contentEditableClassName: RealmNode<string>;
|
|
331
335
|
placeholder: RealmNode<React.ReactNode>;
|
|
332
336
|
autoFocus: RealmNode<boolean>;
|
|
337
|
+
readOnly: RealmNode<boolean>;
|
|
333
338
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
334
339
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
335
340
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -350,7 +355,7 @@ jsxPluginHooks: {
|
|
|
350
355
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
351
356
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
352
357
|
}>;
|
|
353
|
-
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" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "insertJsx">(key: K, callback: (value: ValueForKey<{
|
|
358
|
+
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<{
|
|
354
359
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
355
360
|
} & {
|
|
356
361
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -383,6 +388,7 @@ jsxPluginHooks: {
|
|
|
383
388
|
contentEditableClassName: RealmNode<string>;
|
|
384
389
|
placeholder: RealmNode<React.ReactNode>;
|
|
385
390
|
autoFocus: RealmNode<boolean>;
|
|
391
|
+
readOnly: RealmNode<boolean>;
|
|
386
392
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
387
393
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
388
394
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -436,6 +442,7 @@ jsxPluginHooks: {
|
|
|
436
442
|
contentEditableClassName: RealmNode<string>;
|
|
437
443
|
placeholder: RealmNode<React.ReactNode>;
|
|
438
444
|
autoFocus: RealmNode<boolean>;
|
|
445
|
+
readOnly: RealmNode<boolean>;
|
|
439
446
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
440
447
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
441
448
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -488,6 +495,7 @@ jsxPluginHooks: {
|
|
|
488
495
|
contentEditableClassName: RealmNode<string>;
|
|
489
496
|
placeholder: RealmNode<React.ReactNode>;
|
|
490
497
|
autoFocus: RealmNode<boolean>;
|
|
498
|
+
readOnly: RealmNode<boolean>;
|
|
491
499
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
492
500
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
493
501
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -541,6 +549,7 @@ jsxPluginHooks: {
|
|
|
541
549
|
contentEditableClassName: RealmNode<string>;
|
|
542
550
|
placeholder: RealmNode<React.ReactNode>;
|
|
543
551
|
autoFocus: RealmNode<boolean>;
|
|
552
|
+
readOnly: RealmNode<boolean>;
|
|
544
553
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
545
554
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
546
555
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -561,7 +570,7 @@ jsxPluginHooks: {
|
|
|
561
570
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
562
571
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
563
572
|
}>) => void;
|
|
564
|
-
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" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "insertJsx">(key: K_2) => (value: ValueForKey<{
|
|
573
|
+
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<{
|
|
565
574
|
insertJsx: RealmNode<InsertJsxPayload>;
|
|
566
575
|
} & {
|
|
567
576
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -594,6 +603,7 @@ jsxPluginHooks: {
|
|
|
594
603
|
contentEditableClassName: RealmNode<string>;
|
|
595
604
|
placeholder: RealmNode<React.ReactNode>;
|
|
596
605
|
autoFocus: RealmNode<boolean>;
|
|
606
|
+
readOnly: RealmNode<boolean>;
|
|
597
607
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
598
608
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
599
609
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -60,6 +60,7 @@ export declare const linkPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r
|
|
|
60
60
|
contentEditableClassName: RealmNode<string>;
|
|
61
61
|
placeholder: RealmNode<React.ReactNode>;
|
|
62
62
|
autoFocus: RealmNode<boolean>;
|
|
63
|
+
readOnly: RealmNode<boolean>;
|
|
63
64
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
64
65
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
65
66
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -63,6 +63,7 @@ linkDialogPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
63
63
|
contentEditableClassName: RealmNode<string>;
|
|
64
64
|
placeholder: RealmNode<ReactNode>;
|
|
65
65
|
autoFocus: RealmNode<boolean>;
|
|
66
|
+
readOnly: RealmNode<boolean>;
|
|
66
67
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
67
68
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
68
69
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -113,6 +114,7 @@ linkDialogPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
113
114
|
contentEditableClassName: RealmNode<string>;
|
|
114
115
|
placeholder: RealmNode<ReactNode>;
|
|
115
116
|
autoFocus: RealmNode<boolean>;
|
|
117
|
+
readOnly: RealmNode<boolean>;
|
|
116
118
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
117
119
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
118
120
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -190,6 +192,7 @@ linkDialogPluginHooks: {
|
|
|
190
192
|
contentEditableClassName: RealmNode<string>;
|
|
191
193
|
placeholder: RealmNode<ReactNode>;
|
|
192
194
|
autoFocus: RealmNode<boolean>;
|
|
195
|
+
readOnly: RealmNode<boolean>;
|
|
193
196
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
194
197
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
195
198
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -210,7 +213,7 @@ linkDialogPluginHooks: {
|
|
|
210
213
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
211
214
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
212
215
|
}>;
|
|
213
|
-
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" | "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<{
|
|
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<{
|
|
214
217
|
dialogState: RealmNode<boolean>;
|
|
215
218
|
onWindowChange: RealmNode<true>;
|
|
216
219
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
@@ -252,6 +255,7 @@ linkDialogPluginHooks: {
|
|
|
252
255
|
contentEditableClassName: RealmNode<string>;
|
|
253
256
|
placeholder: RealmNode<ReactNode>;
|
|
254
257
|
autoFocus: RealmNode<boolean>;
|
|
258
|
+
readOnly: RealmNode<boolean>;
|
|
255
259
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
256
260
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
257
261
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -314,6 +318,7 @@ linkDialogPluginHooks: {
|
|
|
314
318
|
contentEditableClassName: RealmNode<string>;
|
|
315
319
|
placeholder: RealmNode<ReactNode>;
|
|
316
320
|
autoFocus: RealmNode<boolean>;
|
|
321
|
+
readOnly: RealmNode<boolean>;
|
|
317
322
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
318
323
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
319
324
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -375,6 +380,7 @@ linkDialogPluginHooks: {
|
|
|
375
380
|
contentEditableClassName: RealmNode<string>;
|
|
376
381
|
placeholder: RealmNode<ReactNode>;
|
|
377
382
|
autoFocus: RealmNode<boolean>;
|
|
383
|
+
readOnly: RealmNode<boolean>;
|
|
378
384
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
379
385
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
380
386
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -437,6 +443,7 @@ linkDialogPluginHooks: {
|
|
|
437
443
|
contentEditableClassName: RealmNode<string>;
|
|
438
444
|
placeholder: RealmNode<ReactNode>;
|
|
439
445
|
autoFocus: RealmNode<boolean>;
|
|
446
|
+
readOnly: RealmNode<boolean>;
|
|
440
447
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
441
448
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
442
449
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -457,7 +464,7 @@ linkDialogPluginHooks: {
|
|
|
457
464
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
458
465
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
459
466
|
}>) => void;
|
|
460
|
-
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" | "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<{
|
|
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<{
|
|
461
468
|
dialogState: RealmNode<boolean>;
|
|
462
469
|
onWindowChange: RealmNode<true>;
|
|
463
470
|
linkDialogState: RealmNode<InactiveLinkDialog | PreviewLinkDialog | EditLinkDialog>;
|
|
@@ -499,6 +506,7 @@ linkDialogPluginHooks: {
|
|
|
499
506
|
contentEditableClassName: RealmNode<string>;
|
|
500
507
|
placeholder: RealmNode<ReactNode>;
|
|
501
508
|
autoFocus: RealmNode<boolean>;
|
|
509
|
+
readOnly: RealmNode<boolean>;
|
|
502
510
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
503
511
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
504
512
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -45,6 +45,7 @@ export declare const listsSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
45
45
|
contentEditableClassName: RealmNode<string>;
|
|
46
46
|
placeholder: RealmNode<ReactNode>;
|
|
47
47
|
autoFocus: RealmNode<boolean>;
|
|
48
|
+
readOnly: RealmNode<boolean>;
|
|
48
49
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
49
50
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
50
51
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -95,6 +96,7 @@ export declare const listsSystem: SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
95
96
|
contentEditableClassName: RealmNode<string>;
|
|
96
97
|
placeholder: RealmNode<ReactNode>;
|
|
97
98
|
autoFocus: RealmNode<boolean>;
|
|
99
|
+
readOnly: RealmNode<boolean>;
|
|
98
100
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
99
101
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
100
102
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -151,6 +153,7 @@ listsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
151
153
|
contentEditableClassName: RealmNode<string>;
|
|
152
154
|
placeholder: RealmNode<ReactNode>;
|
|
153
155
|
autoFocus: RealmNode<boolean>;
|
|
156
|
+
readOnly: RealmNode<boolean>;
|
|
154
157
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
155
158
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
156
159
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -201,6 +204,7 @@ listsPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
201
204
|
contentEditableClassName: RealmNode<string>;
|
|
202
205
|
placeholder: RealmNode<ReactNode>;
|
|
203
206
|
autoFocus: RealmNode<boolean>;
|
|
207
|
+
readOnly: RealmNode<boolean>;
|
|
204
208
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
205
209
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
206
210
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -260,6 +264,7 @@ listsPluginHooks: {
|
|
|
260
264
|
contentEditableClassName: RealmNode<string>;
|
|
261
265
|
placeholder: RealmNode<ReactNode>;
|
|
262
266
|
autoFocus: RealmNode<boolean>;
|
|
267
|
+
readOnly: RealmNode<boolean>;
|
|
263
268
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
264
269
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
265
270
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -280,7 +285,7 @@ listsPluginHooks: {
|
|
|
280
285
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
281
286
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
282
287
|
}>;
|
|
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" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "currentListType" | "applyListType">(key: K, callback: (value: ValueForKey<{
|
|
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<{
|
|
284
289
|
currentListType: RealmNode<"" | ListType>;
|
|
285
290
|
applyListType: RealmNode<"" | ListType>;
|
|
286
291
|
} & {
|
|
@@ -314,6 +319,7 @@ listsPluginHooks: {
|
|
|
314
319
|
contentEditableClassName: RealmNode<string>;
|
|
315
320
|
placeholder: RealmNode<ReactNode>;
|
|
316
321
|
autoFocus: RealmNode<boolean>;
|
|
322
|
+
readOnly: RealmNode<boolean>;
|
|
317
323
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
318
324
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
319
325
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -368,6 +374,7 @@ listsPluginHooks: {
|
|
|
368
374
|
contentEditableClassName: RealmNode<string>;
|
|
369
375
|
placeholder: RealmNode<ReactNode>;
|
|
370
376
|
autoFocus: RealmNode<boolean>;
|
|
377
|
+
readOnly: RealmNode<boolean>;
|
|
371
378
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
372
379
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
373
380
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -421,6 +428,7 @@ listsPluginHooks: {
|
|
|
421
428
|
contentEditableClassName: RealmNode<string>;
|
|
422
429
|
placeholder: RealmNode<ReactNode>;
|
|
423
430
|
autoFocus: RealmNode<boolean>;
|
|
431
|
+
readOnly: RealmNode<boolean>;
|
|
424
432
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
425
433
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
426
434
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -475,6 +483,7 @@ listsPluginHooks: {
|
|
|
475
483
|
contentEditableClassName: RealmNode<string>;
|
|
476
484
|
placeholder: RealmNode<ReactNode>;
|
|
477
485
|
autoFocus: RealmNode<boolean>;
|
|
486
|
+
readOnly: RealmNode<boolean>;
|
|
478
487
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
479
488
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
480
489
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -495,7 +504,7 @@ listsPluginHooks: {
|
|
|
495
504
|
convertSelectionToNode: RealmNode<() => ElementNode>;
|
|
496
505
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
497
506
|
}>) => 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" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "currentListType" | "applyListType">(key: K_2) => (value: ValueForKey<{
|
|
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<{
|
|
499
508
|
currentListType: RealmNode<"" | ListType>;
|
|
500
509
|
applyListType: RealmNode<"" | ListType>;
|
|
501
510
|
} & {
|
|
@@ -529,6 +538,7 @@ listsPluginHooks: {
|
|
|
529
538
|
contentEditableClassName: RealmNode<string>;
|
|
530
539
|
placeholder: RealmNode<ReactNode>;
|
|
531
540
|
autoFocus: RealmNode<boolean>;
|
|
541
|
+
readOnly: RealmNode<boolean>;
|
|
532
542
|
composerChildren: RealmNode<ComponentType<{}>[]>;
|
|
533
543
|
addComposerChild: RealmNode<ComponentType<{}>>;
|
|
534
544
|
topAreaChildren: RealmNode<ComponentType<{}>[]>;
|
|
@@ -7,9 +7,9 @@ import type { EditorSubscription, EditorInFocus, BlockType } from '../core';
|
|
|
7
7
|
import type { InitialEditorStateType } from '@lexical/react/LexicalComposer';
|
|
8
8
|
import type { JsxComponentDescriptor } from '../jsx';
|
|
9
9
|
import type { HistoryState } from '@lexical/history';
|
|
10
|
-
import type { LexicalEditor, RangeSelection, Klass, LexicalNode, TextFormatType, ElementNode, DecoratorNode } from 'lexical';
|
|
11
10
|
import type { PluginConstructor, SystemSpec, Realm, RealmNode } from '../../gurx';
|
|
12
11
|
import React from 'react';
|
|
12
|
+
import type { LexicalEditor, RangeSelection, Klass, LexicalNode, TextFormatType, DecoratorNode, ElementNode } from 'lexical';
|
|
13
13
|
/** @internal */
|
|
14
14
|
export declare const markdownShortcutPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
15
15
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -42,6 +42,7 @@ export declare const markdownShortcutPlugin: PluginConstructor<SystemSpec<[Syste
|
|
|
42
42
|
contentEditableClassName: RealmNode<string>;
|
|
43
43
|
placeholder: RealmNode<React.ReactNode>;
|
|
44
44
|
autoFocus: RealmNode<boolean>;
|
|
45
|
+
readOnly: RealmNode<boolean>;
|
|
45
46
|
composerChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
46
47
|
addComposerChild: RealmNode<React.ComponentType<{}>>;
|
|
47
48
|
topAreaChildren: RealmNode<React.ComponentType<{}>[]>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { QUOTE, LINK, ORDERED_LIST, UNORDERED_LIST, CODE, BOLD_ITALIC_STAR, BOLD_ITALIC_UNDERSCORE, BOLD_STAR, BOLD_UNDERSCORE, INLINE_CODE, ITALIC_STAR, ITALIC_UNDERSCORE } from "@lexical/markdown";
|
|
2
2
|
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin.js";
|
|
3
3
|
import React__default from "react";
|
|
4
4
|
import { CodeBlockNode, $createCodeBlockNode } from "../codeblock/CodeBlockNode.js";
|
|
5
5
|
import { coreSystem } from "../core/index.js";
|
|
6
|
+
import { HeadingNode, $isHeadingNode, $createHeadingNode } from "@lexical/rich-text";
|
|
6
7
|
import { realmPlugin } from "../../gurx/react.js";
|
|
7
8
|
import { system } from "../../gurx/realmFactory.js";
|
|
8
9
|
const [markdownShortcutPlugin] = realmPlugin({
|
|
@@ -10,12 +11,24 @@ const [markdownShortcutPlugin] = realmPlugin({
|
|
|
10
11
|
dependencies: [],
|
|
11
12
|
systemSpec: system((_) => ({}), [coreSystem]),
|
|
12
13
|
init: (realm, _, pluginIds) => {
|
|
13
|
-
const
|
|
14
|
+
const allowedHeadingLevels = pluginIds.includes("headings") ? (
|
|
15
|
+
// @ts-expect-error we query the realm for the allowed heading levels
|
|
16
|
+
realm.getKeyValue("allowedHeadingLevels")
|
|
17
|
+
) : [];
|
|
18
|
+
const transformers = pickTransformersForActivePlugins(pluginIds, allowedHeadingLevels);
|
|
14
19
|
realm.pubKey("addComposerChild", () => /* @__PURE__ */ React__default.createElement(MarkdownShortcutPlugin, { transformers }));
|
|
15
20
|
realm.pubKey("addNestedEditorChild", () => /* @__PURE__ */ React__default.createElement(MarkdownShortcutPlugin, { transformers }));
|
|
16
21
|
}
|
|
17
22
|
});
|
|
18
|
-
|
|
23
|
+
const createBlockNode = (createNode) => {
|
|
24
|
+
return (parentNode, children, match) => {
|
|
25
|
+
const node = createNode(match);
|
|
26
|
+
node.append(...children);
|
|
27
|
+
parentNode.replace(node);
|
|
28
|
+
node.select(0, 0);
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
function pickTransformersForActivePlugins(pluginIds, allowedHeadingLevels) {
|
|
19
32
|
const transformers = [
|
|
20
33
|
BOLD_ITALIC_STAR,
|
|
21
34
|
BOLD_ITALIC_UNDERSCORE,
|
|
@@ -28,6 +41,25 @@ function pickTransformersForActivePlugins(pluginIds) {
|
|
|
28
41
|
// STRIKETHROUGH
|
|
29
42
|
];
|
|
30
43
|
if (pluginIds.includes("headings")) {
|
|
44
|
+
const minHeadingLevel = Math.min(...allowedHeadingLevels);
|
|
45
|
+
const maxHeadingLevel = Math.max(...allowedHeadingLevels);
|
|
46
|
+
const headingRegExp = new RegExp(`^(#{${minHeadingLevel},${maxHeadingLevel}})\\s`);
|
|
47
|
+
const HEADING = {
|
|
48
|
+
dependencies: [HeadingNode],
|
|
49
|
+
export: (node, exportChildren) => {
|
|
50
|
+
if (!$isHeadingNode(node)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const level = Number(node.getTag().slice(1));
|
|
54
|
+
return "#".repeat(level) + " " + exportChildren(node);
|
|
55
|
+
},
|
|
56
|
+
regExp: headingRegExp,
|
|
57
|
+
replace: createBlockNode((match) => {
|
|
58
|
+
const tag = `h${match[1].length}`;
|
|
59
|
+
return $createHeadingNode(tag);
|
|
60
|
+
}),
|
|
61
|
+
type: "element"
|
|
62
|
+
};
|
|
31
63
|
transformers.push(HEADING);
|
|
32
64
|
}
|
|
33
65
|
if (pluginIds.includes("quote")) {
|