@mdxeditor/editor 1.12.1 → 1.13.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 +11 -0
- package/dist/MDXEditor.js +3 -1
- package/dist/importMarkdownToLexical.d.ts +6 -0
- package/dist/importMarkdownToLexical.js +30 -7
- package/dist/index.js +3 -1
- package/dist/plugins/codeblock/index.d.ts +82 -2
- package/dist/plugins/codemirror/index.d.ts +114 -2
- package/dist/plugins/core/index.d.ts +71 -2
- package/dist/plugins/core/index.js +53 -22
- package/dist/plugins/diff-source/DiffSourceWrapper.js +4 -1
- package/dist/plugins/diff-source/index.d.ts +82 -2
- package/dist/plugins/diff-source/index.js +1 -3
- package/dist/plugins/directives/index.d.ts +82 -2
- package/dist/plugins/frontmatter/index.d.ts +82 -2
- package/dist/plugins/headings/index.d.ts +82 -2
- package/dist/plugins/image/index.d.ts +82 -2
- package/dist/plugins/jsx/index.d.ts +82 -12
- package/dist/plugins/link/index.d.ts +8 -0
- package/dist/plugins/link-dialog/index.d.ts +66 -2
- package/dist/plugins/lists/index.d.ts +82 -2
- package/dist/plugins/markdown-shortcut/index.d.ts +8 -0
- package/dist/plugins/quote/index.d.ts +58 -2
- package/dist/plugins/sandpack/index.d.ts +114 -2
- package/dist/plugins/table/index.d.ts +82 -2
- package/dist/plugins/thematic-break/index.d.ts +82 -2
- package/dist/plugins/toolbar/components/ChangeAdmonitionType.js +1 -1
- package/dist/plugins/toolbar/index.d.ts +66 -2
- package/dist/style.css +206 -192
- package/dist/styles/ui.module.css.js +105 -102
- package/package.json +1 -1
|
@@ -87,6 +87,14 @@ export declare const coreSystem: SystemSpec<[], (r: Realm) => {
|
|
|
87
87
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
88
88
|
onBlur: RealmNode<FocusEvent>;
|
|
89
89
|
iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
|
|
90
|
+
markdownProcessingError: RealmNode<{
|
|
91
|
+
error: string;
|
|
92
|
+
source: string;
|
|
93
|
+
} | null>;
|
|
94
|
+
markdownErrorSignal: RealmNode<{
|
|
95
|
+
error: string;
|
|
96
|
+
source: string;
|
|
97
|
+
}>;
|
|
90
98
|
}>;
|
|
91
99
|
interface CorePluginParams {
|
|
92
100
|
initialMarkdown: string;
|
|
@@ -98,9 +106,14 @@ interface CorePluginParams {
|
|
|
98
106
|
};
|
|
99
107
|
onChange: (markdown: string) => void;
|
|
100
108
|
onBlur?: (e: FocusEvent) => void;
|
|
109
|
+
onError?: (payload: {
|
|
110
|
+
error: string;
|
|
111
|
+
source: string;
|
|
112
|
+
}) => void;
|
|
101
113
|
toMarkdownOptions: NonNullable<LexicalConvertOptions['toMarkdownOptions']>;
|
|
102
114
|
readOnly: boolean;
|
|
103
115
|
iconComponentFor: (name: IconKey) => React.ReactElement;
|
|
116
|
+
suppressHtmlProcessing?: boolean;
|
|
104
117
|
}
|
|
105
118
|
export declare const
|
|
106
119
|
/** @internal */
|
|
@@ -161,6 +174,14 @@ corePlugin: PluginConstructor<SystemSpec<[], (r: Realm) => {
|
|
|
161
174
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
162
175
|
onBlur: RealmNode<FocusEvent>;
|
|
163
176
|
iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
|
|
177
|
+
markdownProcessingError: RealmNode<{
|
|
178
|
+
error: string;
|
|
179
|
+
source: string;
|
|
180
|
+
} | null>;
|
|
181
|
+
markdownErrorSignal: RealmNode<{
|
|
182
|
+
error: string;
|
|
183
|
+
source: string;
|
|
184
|
+
}>;
|
|
164
185
|
}>, CorePluginParams>,
|
|
165
186
|
/** @internal */
|
|
166
187
|
corePluginHooks: {
|
|
@@ -221,8 +242,16 @@ corePluginHooks: {
|
|
|
221
242
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
222
243
|
onBlur: RealmNode<FocusEvent>;
|
|
223
244
|
iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
|
|
245
|
+
markdownProcessingError: RealmNode<{
|
|
246
|
+
error: string;
|
|
247
|
+
source: string;
|
|
248
|
+
} | null>;
|
|
249
|
+
markdownErrorSignal: RealmNode<{
|
|
250
|
+
error: string;
|
|
251
|
+
source: string;
|
|
252
|
+
}>;
|
|
224
253
|
}>;
|
|
225
|
-
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor">(key: K, callback: (value: ValueForKey<{
|
|
254
|
+
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "markdownProcessingError" | "markdownErrorSignal">(key: K, callback: (value: ValueForKey<{
|
|
226
255
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
227
256
|
inFocus: RealmNode<boolean>;
|
|
228
257
|
historyState: RealmNode<HistoryState>;
|
|
@@ -279,6 +308,14 @@ corePluginHooks: {
|
|
|
279
308
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
280
309
|
onBlur: RealmNode<FocusEvent>;
|
|
281
310
|
iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
|
|
311
|
+
markdownProcessingError: RealmNode<{
|
|
312
|
+
error: string;
|
|
313
|
+
source: string;
|
|
314
|
+
} | null>;
|
|
315
|
+
markdownErrorSignal: RealmNode<{
|
|
316
|
+
error: string;
|
|
317
|
+
source: string;
|
|
318
|
+
}>;
|
|
282
319
|
}, K>) => void) => void;
|
|
283
320
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
284
321
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -337,6 +374,14 @@ corePluginHooks: {
|
|
|
337
374
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
338
375
|
onBlur: RealmNode<FocusEvent>;
|
|
339
376
|
iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
|
|
377
|
+
markdownProcessingError: RealmNode<{
|
|
378
|
+
error: string;
|
|
379
|
+
source: string;
|
|
380
|
+
} | null>;
|
|
381
|
+
markdownErrorSignal: RealmNode<{
|
|
382
|
+
error: string;
|
|
383
|
+
source: string;
|
|
384
|
+
}>;
|
|
340
385
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
341
386
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
342
387
|
inFocus: RealmNode<boolean>;
|
|
@@ -394,6 +439,14 @@ corePluginHooks: {
|
|
|
394
439
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
395
440
|
onBlur: RealmNode<FocusEvent>;
|
|
396
441
|
iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
|
|
442
|
+
markdownProcessingError: RealmNode<{
|
|
443
|
+
error: string;
|
|
444
|
+
source: string;
|
|
445
|
+
} | null>;
|
|
446
|
+
markdownErrorSignal: RealmNode<{
|
|
447
|
+
error: string;
|
|
448
|
+
source: string;
|
|
449
|
+
}>;
|
|
397
450
|
}, K_1>;
|
|
398
451
|
usePubKeys: () => (values: SystemDict<{
|
|
399
452
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
@@ -452,8 +505,16 @@ corePluginHooks: {
|
|
|
452
505
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
453
506
|
onBlur: RealmNode<FocusEvent>;
|
|
454
507
|
iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
|
|
508
|
+
markdownProcessingError: RealmNode<{
|
|
509
|
+
error: string;
|
|
510
|
+
source: string;
|
|
511
|
+
} | null>;
|
|
512
|
+
markdownErrorSignal: RealmNode<{
|
|
513
|
+
error: string;
|
|
514
|
+
source: string;
|
|
515
|
+
}>;
|
|
455
516
|
}>) => void;
|
|
456
|
-
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor">(key: K_2) => (value: ValueForKey<{
|
|
517
|
+
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "markdownProcessingError" | "markdownErrorSignal">(key: K_2) => (value: ValueForKey<{
|
|
457
518
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
458
519
|
inFocus: RealmNode<boolean>;
|
|
459
520
|
historyState: RealmNode<HistoryState>;
|
|
@@ -510,5 +571,13 @@ corePluginHooks: {
|
|
|
510
571
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
511
572
|
onBlur: RealmNode<FocusEvent>;
|
|
512
573
|
iconComponentFor: RealmNode<(name: IconKey) => React.ReactNode>;
|
|
574
|
+
markdownProcessingError: RealmNode<{
|
|
575
|
+
error: string;
|
|
576
|
+
source: string;
|
|
577
|
+
} | null>;
|
|
578
|
+
markdownErrorSignal: RealmNode<{
|
|
579
|
+
error: string;
|
|
580
|
+
source: string;
|
|
581
|
+
}>;
|
|
513
582
|
}, K_2>) => void;
|
|
514
583
|
};
|
|
@@ -4,7 +4,7 @@ import { $setBlocksType } from "@lexical/selection";
|
|
|
4
4
|
import { $findMatchingParent, $wrapNodeInElement, $insertNodeToNearestRoot } from "@lexical/utils";
|
|
5
5
|
import { createCommand, SELECTION_CHANGE_COMMAND, $getRoot, COMMAND_PRIORITY_CRITICAL, $setSelection, BLUR_COMMAND, FOCUS_COMMAND, KEY_DOWN_COMMAND, $isDecoratorNode, FORMAT_TEXT_COMMAND, $isRootOrShadowRoot, $getSelection, $isRangeSelection, $insertNodes, $createParagraphNode, ParagraphNode, TextNode } from "lexical";
|
|
6
6
|
import { exportMarkdownFromLexical } from "../../exportMarkdownFromLexical.js";
|
|
7
|
-
import { importMarkdownToLexical } from "../../importMarkdownToLexical.js";
|
|
7
|
+
import { importMarkdownToLexical, MarkdownParseError, UnrecognizedMarkdownConstructError } from "../../importMarkdownToLexical.js";
|
|
8
8
|
import { LexicalLinebreakVisitor } from "./LexicalLinebreakVisitor.js";
|
|
9
9
|
import { LexicalParagraphVisitor } from "./LexicalParagraphVisitor.js";
|
|
10
10
|
import { LexicalRootVisitor } from "./LexicalRootVisitor.js";
|
|
@@ -53,6 +53,15 @@ const coreSystem = system((r) => {
|
|
|
53
53
|
const autoFocus = r.node(false);
|
|
54
54
|
const inFocus = r.node(false, true);
|
|
55
55
|
const currentFormat = r.node(0, true);
|
|
56
|
+
const markdownProcessingError = r.node(null);
|
|
57
|
+
const markdownErrorSignal = r.node();
|
|
58
|
+
r.link(
|
|
59
|
+
r.pipe(
|
|
60
|
+
markdownProcessingError,
|
|
61
|
+
r.o.filter((e) => e !== null)
|
|
62
|
+
),
|
|
63
|
+
markdownErrorSignal
|
|
64
|
+
);
|
|
56
65
|
const applyFormat = r.node();
|
|
57
66
|
const currentSelection = r.node(null);
|
|
58
67
|
const activeEditorSubscriptions = r.node([]);
|
|
@@ -108,6 +117,10 @@ const coreSystem = system((r) => {
|
|
|
108
117
|
});
|
|
109
118
|
r.pub(createRootEditorSubscription, (theRootEditor) => {
|
|
110
119
|
return theRootEditor.registerUpdateListener(({ dirtyElements, dirtyLeaves, editorState }) => {
|
|
120
|
+
const err = r.getValue(markdownProcessingError);
|
|
121
|
+
if (err !== null) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
111
124
|
if (dirtyElements.size === 0 && dirtyLeaves.size === 0) {
|
|
112
125
|
return;
|
|
113
126
|
}
|
|
@@ -147,24 +160,42 @@ const coreSystem = system((r) => {
|
|
|
147
160
|
const addExportVisitor = createAppendNodeFor(exportVisitors);
|
|
148
161
|
const addToMarkdownExtension = createAppendNodeFor(toMarkdownExtensions);
|
|
149
162
|
const setMarkdown = r.node();
|
|
163
|
+
function tryImportingMarkdown(markdownValue) {
|
|
164
|
+
try {
|
|
165
|
+
importMarkdownToLexical({
|
|
166
|
+
root: $getRoot(),
|
|
167
|
+
visitors: r.getValue(importVisitors),
|
|
168
|
+
mdastExtensions: r.getValue(mdastExtensions),
|
|
169
|
+
markdown: markdownValue,
|
|
170
|
+
syntaxExtensions: r.getValue(syntaxExtensions)
|
|
171
|
+
});
|
|
172
|
+
r.pub(markdownProcessingError, null);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
if (e instanceof MarkdownParseError || e instanceof UnrecognizedMarkdownConstructError) {
|
|
175
|
+
r.pubIn({
|
|
176
|
+
[markdown.key]: markdownValue,
|
|
177
|
+
[markdownProcessingError.key]: {
|
|
178
|
+
error: e.message,
|
|
179
|
+
source: markdown
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
} else {
|
|
183
|
+
throw e;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
150
187
|
r.sub(
|
|
151
188
|
r.pipe(
|
|
152
189
|
setMarkdown,
|
|
153
|
-
r.o.withLatestFrom(markdown, rootEditor,
|
|
190
|
+
r.o.withLatestFrom(markdown, rootEditor, inFocus),
|
|
154
191
|
r.o.filter(([newMarkdown, oldMarkdown]) => {
|
|
155
192
|
return newMarkdown.trim() !== oldMarkdown.trim();
|
|
156
193
|
})
|
|
157
194
|
),
|
|
158
|
-
([theNewMarkdownValue, , editor,
|
|
195
|
+
([theNewMarkdownValue, , editor, inFocus2]) => {
|
|
159
196
|
editor == null ? void 0 : editor.update(() => {
|
|
160
197
|
$getRoot().clear();
|
|
161
|
-
|
|
162
|
-
root: $getRoot(),
|
|
163
|
-
visitors: importVisitors2,
|
|
164
|
-
mdastExtensions: mdastExtensions2,
|
|
165
|
-
markdown: theNewMarkdownValue,
|
|
166
|
-
syntaxExtensions: syntaxExtensions2
|
|
167
|
-
});
|
|
198
|
+
tryImportingMarkdown(theNewMarkdownValue);
|
|
168
199
|
if (!inFocus2) {
|
|
169
200
|
$setSelection(null);
|
|
170
201
|
} else {
|
|
@@ -176,13 +207,7 @@ const coreSystem = system((r) => {
|
|
|
176
207
|
const initialRootEditorState = r.node((theRootEditor) => {
|
|
177
208
|
r.pub(rootEditor, theRootEditor);
|
|
178
209
|
r.pub(activeEditor, theRootEditor);
|
|
179
|
-
|
|
180
|
-
root: $getRoot(),
|
|
181
|
-
visitors: r.getValue(importVisitors),
|
|
182
|
-
mdastExtensions: r.getValue(mdastExtensions),
|
|
183
|
-
markdown: r.getValue(initialMarkdown),
|
|
184
|
-
syntaxExtensions: r.getValue(syntaxExtensions)
|
|
185
|
-
});
|
|
210
|
+
tryImportingMarkdown(r.getValue(initialMarkdown));
|
|
186
211
|
const autoFocusValue = r.getValue(autoFocus);
|
|
187
212
|
if (autoFocusValue) {
|
|
188
213
|
if (autoFocusValue === true) {
|
|
@@ -402,7 +427,10 @@ const coreSystem = system((r) => {
|
|
|
402
427
|
insertDecoratorNode,
|
|
403
428
|
// Events
|
|
404
429
|
onBlur,
|
|
405
|
-
iconComponentFor
|
|
430
|
+
iconComponentFor,
|
|
431
|
+
// error handling
|
|
432
|
+
markdownProcessingError,
|
|
433
|
+
markdownErrorSignal
|
|
406
434
|
};
|
|
407
435
|
}, []);
|
|
408
436
|
const [
|
|
@@ -423,20 +451,17 @@ const [
|
|
|
423
451
|
});
|
|
424
452
|
realm.singletonSubKey("markdownSignal", params.onChange);
|
|
425
453
|
realm.singletonSubKey("onBlur", params.onBlur);
|
|
454
|
+
realm.singletonSubKey("markdownErrorSignal", params.onError);
|
|
426
455
|
},
|
|
427
456
|
init(realm, params) {
|
|
428
457
|
realm.pubKey("initialMarkdown", params.initialMarkdown.trim());
|
|
429
458
|
realm.pubKey("iconComponentFor", params.iconComponentFor);
|
|
430
|
-
realm.pubKey("addMdastExtension", mdxJsxFromMarkdown());
|
|
431
|
-
realm.pubKey("addSyntaxExtension", mdxJsx());
|
|
432
|
-
realm.pubKey("addToMarkdownExtension", mdxJsxToMarkdown());
|
|
433
459
|
realm.pubKey("addImportVisitor", MdastRootVisitor);
|
|
434
460
|
realm.pubKey("addImportVisitor", MdastParagraphVisitor);
|
|
435
461
|
realm.pubKey("addImportVisitor", MdastTextVisitor);
|
|
436
462
|
realm.pubKey("addImportVisitor", MdastFormattingVisitor);
|
|
437
463
|
realm.pubKey("addImportVisitor", MdastInlineCodeVisitor);
|
|
438
464
|
realm.pubKey("addImportVisitor", MdastBreakVisitor);
|
|
439
|
-
realm.pubKey("addImportVisitor", MdastHTMLVisitor);
|
|
440
465
|
realm.pubKey("addLexicalNode", ParagraphNode);
|
|
441
466
|
realm.pubKey("addLexicalNode", TextNode);
|
|
442
467
|
realm.pubKey("addLexicalNode", GenericHTMLNode);
|
|
@@ -446,6 +471,12 @@ const [
|
|
|
446
471
|
realm.pubKey("addExportVisitor", LexicalLinebreakVisitor);
|
|
447
472
|
realm.pubKey("addExportVisitor", LexicalGenericHTMLVisitor);
|
|
448
473
|
realm.pubKey("addComposerChild", SharedHistoryPlugin);
|
|
474
|
+
if (!params.suppressHtmlProcessing) {
|
|
475
|
+
realm.pubKey("addMdastExtension", mdxJsxFromMarkdown());
|
|
476
|
+
realm.pubKey("addSyntaxExtension", mdxJsx());
|
|
477
|
+
realm.pubKey("addToMarkdownExtension", mdxJsxToMarkdown());
|
|
478
|
+
realm.pubKey("addImportVisitor", MdastHTMLVisitor);
|
|
479
|
+
}
|
|
449
480
|
}
|
|
450
481
|
});
|
|
451
482
|
export {
|
|
@@ -2,9 +2,12 @@ import React__default from "react";
|
|
|
2
2
|
import { diffSourcePluginHooks } from "./index.js";
|
|
3
3
|
import { DiffViewer } from "./DiffViewer.js";
|
|
4
4
|
import { SourceEditor } from "./SourceEditor.js";
|
|
5
|
+
import { corePluginHooks } from "../core/index.js";
|
|
6
|
+
import styles from "../../styles/ui.module.css.js";
|
|
5
7
|
const DiffSourceWrapper = ({ children }) => {
|
|
8
|
+
const [error] = corePluginHooks.useEmitterValues("markdownProcessingError");
|
|
6
9
|
const [viewMode] = diffSourcePluginHooks.useEmitterValues("viewMode");
|
|
7
|
-
return /* @__PURE__ */ React__default.createElement("div", null, /* @__PURE__ */ React__default.createElement("div", { style: { display: viewMode === "rich-text" ? "block" : "none" } }, children), viewMode === "diff" ? /* @__PURE__ */ React__default.createElement(DiffViewer, null) : null, viewMode === "source" ? /* @__PURE__ */ React__default.createElement(SourceEditor, null) : null);
|
|
10
|
+
return /* @__PURE__ */ React__default.createElement("div", null, error ? /* @__PURE__ */ React__default.createElement("div", { className: styles.markdownParseError }, /* @__PURE__ */ React__default.createElement("p", null, error.error, "."), /* @__PURE__ */ React__default.createElement("p", null, "You can fix the errors in source mode and switch to rich text mode when you are ready.")) : null, /* @__PURE__ */ React__default.createElement("div", { style: { display: viewMode === "rich-text" && error == null ? "block" : "none" } }, children), viewMode === "diff" ? /* @__PURE__ */ React__default.createElement(DiffViewer, null) : null, viewMode === "source" ? /* @__PURE__ */ React__default.createElement(SourceEditor, null) : null);
|
|
8
11
|
};
|
|
9
12
|
export {
|
|
10
13
|
DiffSourceWrapper
|
|
@@ -73,6 +73,14 @@ export declare const diffSourceSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
73
73
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
74
74
|
onBlur: RealmNode<FocusEvent>;
|
|
75
75
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
76
|
+
markdownProcessingError: RealmNode<{
|
|
77
|
+
error: string;
|
|
78
|
+
source: string;
|
|
79
|
+
} | null>;
|
|
80
|
+
markdownErrorSignal: RealmNode<{
|
|
81
|
+
error: string;
|
|
82
|
+
source: string;
|
|
83
|
+
}>;
|
|
76
84
|
}>], (r: Realm, [{ markdown, setMarkdown, markdownSignal }]: [{
|
|
77
85
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
78
86
|
inFocus: RealmNode<boolean>;
|
|
@@ -130,6 +138,14 @@ export declare const diffSourceSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
130
138
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
131
139
|
onBlur: RealmNode<FocusEvent>;
|
|
132
140
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
141
|
+
markdownProcessingError: RealmNode<{
|
|
142
|
+
error: string;
|
|
143
|
+
source: string;
|
|
144
|
+
} | null>;
|
|
145
|
+
markdownErrorSignal: RealmNode<{
|
|
146
|
+
error: string;
|
|
147
|
+
source: string;
|
|
148
|
+
}>;
|
|
133
149
|
}]) => {
|
|
134
150
|
viewMode: RealmNode<ViewMode>;
|
|
135
151
|
diffMarkdown: RealmNode<string>;
|
|
@@ -200,6 +216,14 @@ diffSourcePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
200
216
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
201
217
|
onBlur: RealmNode<FocusEvent>;
|
|
202
218
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
219
|
+
markdownProcessingError: RealmNode<{
|
|
220
|
+
error: string;
|
|
221
|
+
source: string;
|
|
222
|
+
} | null>;
|
|
223
|
+
markdownErrorSignal: RealmNode<{
|
|
224
|
+
error: string;
|
|
225
|
+
source: string;
|
|
226
|
+
}>;
|
|
203
227
|
}>], (r: Realm, [{ markdown, setMarkdown, markdownSignal }]: [{
|
|
204
228
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
205
229
|
inFocus: RealmNode<boolean>;
|
|
@@ -257,6 +281,14 @@ diffSourcePlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
257
281
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
258
282
|
onBlur: RealmNode<FocusEvent>;
|
|
259
283
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
284
|
+
markdownProcessingError: RealmNode<{
|
|
285
|
+
error: string;
|
|
286
|
+
source: string;
|
|
287
|
+
} | null>;
|
|
288
|
+
markdownErrorSignal: RealmNode<{
|
|
289
|
+
error: string;
|
|
290
|
+
source: string;
|
|
291
|
+
}>;
|
|
260
292
|
}]) => {
|
|
261
293
|
viewMode: RealmNode<ViewMode>;
|
|
262
294
|
diffMarkdown: RealmNode<string>;
|
|
@@ -327,8 +359,16 @@ diffSourcePluginHooks: {
|
|
|
327
359
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
328
360
|
onBlur: RealmNode<FocusEvent>;
|
|
329
361
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
362
|
+
markdownProcessingError: RealmNode<{
|
|
363
|
+
error: string;
|
|
364
|
+
source: string;
|
|
365
|
+
} | null>;
|
|
366
|
+
markdownErrorSignal: RealmNode<{
|
|
367
|
+
error: string;
|
|
368
|
+
source: string;
|
|
369
|
+
}>;
|
|
330
370
|
}>;
|
|
331
|
-
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "markdownSourceEditorValue" | "viewMode" | "diffMarkdown" | "cmExtensions">(key: K, callback: (value: ValueForKey<{
|
|
371
|
+
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "markdownProcessingError" | "markdownErrorSignal" | "markdownSourceEditorValue" | "viewMode" | "diffMarkdown" | "cmExtensions">(key: K, callback: (value: ValueForKey<{
|
|
332
372
|
viewMode: RealmNode<ViewMode>;
|
|
333
373
|
diffMarkdown: RealmNode<string>;
|
|
334
374
|
markdownSourceEditorValue: RealmNode<string>;
|
|
@@ -390,6 +430,14 @@ diffSourcePluginHooks: {
|
|
|
390
430
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
391
431
|
onBlur: RealmNode<FocusEvent>;
|
|
392
432
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
433
|
+
markdownProcessingError: RealmNode<{
|
|
434
|
+
error: string;
|
|
435
|
+
source: string;
|
|
436
|
+
} | null>;
|
|
437
|
+
markdownErrorSignal: RealmNode<{
|
|
438
|
+
error: string;
|
|
439
|
+
source: string;
|
|
440
|
+
}>;
|
|
393
441
|
}, K>) => void) => void;
|
|
394
442
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
395
443
|
viewMode: RealmNode<ViewMode>;
|
|
@@ -453,6 +501,14 @@ diffSourcePluginHooks: {
|
|
|
453
501
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
454
502
|
onBlur: RealmNode<FocusEvent>;
|
|
455
503
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
504
|
+
markdownProcessingError: RealmNode<{
|
|
505
|
+
error: string;
|
|
506
|
+
source: string;
|
|
507
|
+
} | null>;
|
|
508
|
+
markdownErrorSignal: RealmNode<{
|
|
509
|
+
error: string;
|
|
510
|
+
source: string;
|
|
511
|
+
}>;
|
|
456
512
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
457
513
|
viewMode: RealmNode<ViewMode>;
|
|
458
514
|
diffMarkdown: RealmNode<string>;
|
|
@@ -515,6 +571,14 @@ diffSourcePluginHooks: {
|
|
|
515
571
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
516
572
|
onBlur: RealmNode<FocusEvent>;
|
|
517
573
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
574
|
+
markdownProcessingError: RealmNode<{
|
|
575
|
+
error: string;
|
|
576
|
+
source: string;
|
|
577
|
+
} | null>;
|
|
578
|
+
markdownErrorSignal: RealmNode<{
|
|
579
|
+
error: string;
|
|
580
|
+
source: string;
|
|
581
|
+
}>;
|
|
518
582
|
}, K_1>;
|
|
519
583
|
usePubKeys: () => (values: SystemDict<{
|
|
520
584
|
viewMode: RealmNode<ViewMode>;
|
|
@@ -578,8 +642,16 @@ diffSourcePluginHooks: {
|
|
|
578
642
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
579
643
|
onBlur: RealmNode<FocusEvent>;
|
|
580
644
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
645
|
+
markdownProcessingError: RealmNode<{
|
|
646
|
+
error: string;
|
|
647
|
+
source: string;
|
|
648
|
+
} | null>;
|
|
649
|
+
markdownErrorSignal: RealmNode<{
|
|
650
|
+
error: string;
|
|
651
|
+
source: string;
|
|
652
|
+
}>;
|
|
581
653
|
}>) => void;
|
|
582
|
-
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "markdownSourceEditorValue" | "viewMode" | "diffMarkdown" | "cmExtensions">(key: K_2) => (value: ValueForKey<{
|
|
654
|
+
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "markdownProcessingError" | "markdownErrorSignal" | "markdownSourceEditorValue" | "viewMode" | "diffMarkdown" | "cmExtensions">(key: K_2) => (value: ValueForKey<{
|
|
583
655
|
viewMode: RealmNode<ViewMode>;
|
|
584
656
|
diffMarkdown: RealmNode<string>;
|
|
585
657
|
markdownSourceEditorValue: RealmNode<string>;
|
|
@@ -641,5 +713,13 @@ diffSourcePluginHooks: {
|
|
|
641
713
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
642
714
|
onBlur: RealmNode<FocusEvent>;
|
|
643
715
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
716
|
+
markdownProcessingError: RealmNode<{
|
|
717
|
+
error: string;
|
|
718
|
+
source: string;
|
|
719
|
+
} | null>;
|
|
720
|
+
markdownErrorSignal: RealmNode<{
|
|
721
|
+
error: string;
|
|
722
|
+
source: string;
|
|
723
|
+
}>;
|
|
644
724
|
}, K_2>) => void;
|
|
645
725
|
};
|
|
@@ -42,13 +42,11 @@ const [
|
|
|
42
42
|
] = realmPlugin({
|
|
43
43
|
id: "diff-source",
|
|
44
44
|
systemSpec: diffSourceSystem,
|
|
45
|
-
applyParamsToSystem(r, params) {
|
|
46
|
-
r.pubKey("viewMode", (params == null ? void 0 : params.viewMode) || "rich-text");
|
|
47
|
-
},
|
|
48
45
|
init(r, params) {
|
|
49
46
|
r.pubKey("diffMarkdown", (params == null ? void 0 : params.diffMarkdown) || "");
|
|
50
47
|
r.pubKey("cmExtensions", (params == null ? void 0 : params.codeMirrorExtensions) || []);
|
|
51
48
|
r.pubKey("addEditorWrapper", DiffSourceWrapper);
|
|
49
|
+
r.pubKey("viewMode", (params == null ? void 0 : params.viewMode) || "rich-text");
|
|
52
50
|
}
|
|
53
51
|
});
|
|
54
52
|
export {
|
|
@@ -129,6 +129,14 @@ export declare const directivesSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
129
129
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
130
130
|
onBlur: RealmNode<FocusEvent>;
|
|
131
131
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
132
|
+
markdownProcessingError: RealmNode<{
|
|
133
|
+
error: string;
|
|
134
|
+
source: string;
|
|
135
|
+
} | null>;
|
|
136
|
+
markdownErrorSignal: RealmNode<{
|
|
137
|
+
error: string;
|
|
138
|
+
source: string;
|
|
139
|
+
}>;
|
|
132
140
|
}>], (r: Realm, [{ insertDecoratorNode }]: [{
|
|
133
141
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
134
142
|
inFocus: RealmNode<boolean>;
|
|
@@ -186,6 +194,14 @@ export declare const directivesSystem: SystemSpec<[SystemSpec<[], (r: Realm) =>
|
|
|
186
194
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
187
195
|
onBlur: RealmNode<FocusEvent>;
|
|
188
196
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
197
|
+
markdownProcessingError: RealmNode<{
|
|
198
|
+
error: string;
|
|
199
|
+
source: string;
|
|
200
|
+
} | null>;
|
|
201
|
+
markdownErrorSignal: RealmNode<{
|
|
202
|
+
error: string;
|
|
203
|
+
source: string;
|
|
204
|
+
}>;
|
|
189
205
|
}]) => {
|
|
190
206
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
191
207
|
insertDirective: RealmNode<InsertDirectivePayload>;
|
|
@@ -261,6 +277,14 @@ directivesPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
261
277
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
262
278
|
onBlur: RealmNode<FocusEvent>;
|
|
263
279
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
280
|
+
markdownProcessingError: RealmNode<{
|
|
281
|
+
error: string;
|
|
282
|
+
source: string;
|
|
283
|
+
} | null>;
|
|
284
|
+
markdownErrorSignal: RealmNode<{
|
|
285
|
+
error: string;
|
|
286
|
+
source: string;
|
|
287
|
+
}>;
|
|
264
288
|
}>], (r: Realm, [{ insertDecoratorNode }]: [{
|
|
265
289
|
activeEditor: RealmNode<LexicalEditor | null>;
|
|
266
290
|
inFocus: RealmNode<boolean>;
|
|
@@ -318,6 +342,14 @@ directivesPlugin: PluginConstructor<SystemSpec<[SystemSpec<[], (r: Realm) => {
|
|
|
318
342
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
319
343
|
onBlur: RealmNode<FocusEvent>;
|
|
320
344
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
345
|
+
markdownProcessingError: RealmNode<{
|
|
346
|
+
error: string;
|
|
347
|
+
source: string;
|
|
348
|
+
} | null>;
|
|
349
|
+
markdownErrorSignal: RealmNode<{
|
|
350
|
+
error: string;
|
|
351
|
+
source: string;
|
|
352
|
+
}>;
|
|
321
353
|
}]) => {
|
|
322
354
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
323
355
|
insertDirective: RealmNode<InsertDirectivePayload>;
|
|
@@ -384,8 +416,16 @@ directivesPluginHooks: {
|
|
|
384
416
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
385
417
|
onBlur: RealmNode<FocusEvent>;
|
|
386
418
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
419
|
+
markdownProcessingError: RealmNode<{
|
|
420
|
+
error: string;
|
|
421
|
+
source: string;
|
|
422
|
+
} | null>;
|
|
423
|
+
markdownErrorSignal: RealmNode<{
|
|
424
|
+
error: string;
|
|
425
|
+
source: string;
|
|
426
|
+
}>;
|
|
387
427
|
}>;
|
|
388
|
-
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "directiveDescriptors" | "insertDirective">(key: K, callback: (value: ValueForKey<{
|
|
428
|
+
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "markdownProcessingError" | "markdownErrorSignal" | "directiveDescriptors" | "insertDirective">(key: K, callback: (value: ValueForKey<{
|
|
389
429
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
390
430
|
insertDirective: RealmNode<InsertDirectivePayload>;
|
|
391
431
|
} & {
|
|
@@ -445,6 +485,14 @@ directivesPluginHooks: {
|
|
|
445
485
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
446
486
|
onBlur: RealmNode<FocusEvent>;
|
|
447
487
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
488
|
+
markdownProcessingError: RealmNode<{
|
|
489
|
+
error: string;
|
|
490
|
+
source: string;
|
|
491
|
+
} | null>;
|
|
492
|
+
markdownErrorSignal: RealmNode<{
|
|
493
|
+
error: string;
|
|
494
|
+
source: string;
|
|
495
|
+
}>;
|
|
448
496
|
}, K>) => void) => void;
|
|
449
497
|
useEmitterValues: <K_1 extends SystemKeys<{
|
|
450
498
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
@@ -506,6 +554,14 @@ directivesPluginHooks: {
|
|
|
506
554
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
507
555
|
onBlur: RealmNode<FocusEvent>;
|
|
508
556
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
557
|
+
markdownProcessingError: RealmNode<{
|
|
558
|
+
error: string;
|
|
559
|
+
source: string;
|
|
560
|
+
} | null>;
|
|
561
|
+
markdownErrorSignal: RealmNode<{
|
|
562
|
+
error: string;
|
|
563
|
+
source: string;
|
|
564
|
+
}>;
|
|
509
565
|
}>>(...keys: K_1) => ValuesForKeys<{
|
|
510
566
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
511
567
|
insertDirective: RealmNode<InsertDirectivePayload>;
|
|
@@ -566,6 +622,14 @@ directivesPluginHooks: {
|
|
|
566
622
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
567
623
|
onBlur: RealmNode<FocusEvent>;
|
|
568
624
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
625
|
+
markdownProcessingError: RealmNode<{
|
|
626
|
+
error: string;
|
|
627
|
+
source: string;
|
|
628
|
+
} | null>;
|
|
629
|
+
markdownErrorSignal: RealmNode<{
|
|
630
|
+
error: string;
|
|
631
|
+
source: string;
|
|
632
|
+
}>;
|
|
569
633
|
}, K_1>;
|
|
570
634
|
usePubKeys: () => (values: SystemDict<{
|
|
571
635
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
@@ -627,8 +691,16 @@ directivesPluginHooks: {
|
|
|
627
691
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
628
692
|
onBlur: RealmNode<FocusEvent>;
|
|
629
693
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
694
|
+
markdownProcessingError: RealmNode<{
|
|
695
|
+
error: string;
|
|
696
|
+
source: string;
|
|
697
|
+
} | null>;
|
|
698
|
+
markdownErrorSignal: RealmNode<{
|
|
699
|
+
error: string;
|
|
700
|
+
source: string;
|
|
701
|
+
}>;
|
|
630
702
|
}>) => void;
|
|
631
|
-
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "directiveDescriptors" | "insertDirective">(key: K_2) => (value: ValueForKey<{
|
|
703
|
+
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" | "markdownSignal" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "iconComponentFor" | "markdownProcessingError" | "markdownErrorSignal" | "directiveDescriptors" | "insertDirective">(key: K_2) => (value: ValueForKey<{
|
|
632
704
|
directiveDescriptors: RealmNode<DirectiveDescriptor<any>[]>;
|
|
633
705
|
insertDirective: RealmNode<InsertDirectivePayload>;
|
|
634
706
|
} & {
|
|
@@ -688,6 +760,14 @@ directivesPluginHooks: {
|
|
|
688
760
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
689
761
|
onBlur: RealmNode<FocusEvent>;
|
|
690
762
|
iconComponentFor: RealmNode<(name: IconKey) => ReactNode>;
|
|
763
|
+
markdownProcessingError: RealmNode<{
|
|
764
|
+
error: string;
|
|
765
|
+
source: string;
|
|
766
|
+
} | null>;
|
|
767
|
+
markdownErrorSignal: RealmNode<{
|
|
768
|
+
error: string;
|
|
769
|
+
source: string;
|
|
770
|
+
}>;
|
|
691
771
|
}, K_2>) => void;
|
|
692
772
|
};
|
|
693
773
|
export {};
|