@mdxeditor/editor 3.44.2 → 3.45.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/index.d.ts +6 -6
- package/dist/plugins/core/index.js +18 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1170,7 +1170,7 @@ export declare const EmptyTextNodeIndex: TextNodeIndex;
|
|
|
1170
1170
|
|
|
1171
1171
|
/* Excluded from this release type: ExportLexicalTreeOptions */
|
|
1172
1172
|
|
|
1173
|
-
|
|
1173
|
+
export declare function exportLexicalTreeToMdast({ root, visitors, jsxComponentDescriptors, jsxIsAvailable, addImportStatements }: ExportLexicalTreeOptions): Mdast.Root;
|
|
1174
1174
|
|
|
1175
1175
|
/* Excluded from this release type: exportMarkdownFromLexical */
|
|
1176
1176
|
|
|
@@ -1466,7 +1466,7 @@ export declare type ImageUploadHandler = ((image: File) => Promise<string>) | nu
|
|
|
1466
1466
|
|
|
1467
1467
|
/* Excluded from this release type: importMarkdownToLexical */
|
|
1468
1468
|
|
|
1469
|
-
|
|
1469
|
+
export declare function importMdastTreeToLexical({ root, mdastRoot, visitors, ...descriptors }: MdastTreeImportOptions): void;
|
|
1470
1470
|
|
|
1471
1471
|
export declare interface ImportPoint {
|
|
1472
1472
|
append(node: LexicalNode): void;
|
|
@@ -1707,7 +1707,7 @@ export declare function isMdastHTMLNode(node: Mdast.Nodes): node is MdastHTMLNod
|
|
|
1707
1707
|
*/
|
|
1708
1708
|
export declare function isMdastJsxNode(node: Mdast.Nodes): node is MdastJsx;
|
|
1709
1709
|
|
|
1710
|
-
|
|
1710
|
+
export declare function isPartOftheEditorUI(element: HTMLElement | null, editorRoot: HTMLElement): boolean;
|
|
1711
1711
|
|
|
1712
1712
|
/**
|
|
1713
1713
|
* returns a function which calls all passed functions in the passed order.
|
|
@@ -2308,9 +2308,9 @@ export declare interface MDXEditorProps {
|
|
|
2308
2308
|
*/
|
|
2309
2309
|
suppressSharedHistory?: boolean;
|
|
2310
2310
|
/**
|
|
2311
|
-
* The initial state of the lexical editor.
|
|
2311
|
+
* The initial state of the lexical editor. Pass null to disable any initiation.
|
|
2312
2312
|
*/
|
|
2313
|
-
editorState?: EditorState | undefined;
|
|
2313
|
+
editorState?: EditorState | undefined | null;
|
|
2314
2314
|
}
|
|
2315
2315
|
|
|
2316
2316
|
/**
|
|
@@ -2342,7 +2342,7 @@ export declare const MultipleChoiceToggleGroup: default_2.FC<{
|
|
|
2342
2342
|
|
|
2343
2343
|
export declare const muteChange$: NodeRef<boolean>;
|
|
2344
2344
|
|
|
2345
|
-
|
|
2345
|
+
export declare const NESTED_EDITOR_UPDATED_COMMAND: LexicalCommand<undefined>;
|
|
2346
2346
|
|
|
2347
2347
|
/* Excluded from this release type: nestedEditorChildren$ */
|
|
2348
2348
|
|
|
@@ -543,7 +543,7 @@ const corePlugin = realmPlugin({
|
|
|
543
543
|
},
|
|
544
544
|
postInit(r, params) {
|
|
545
545
|
const newEditor = createEditor({
|
|
546
|
-
...(params
|
|
546
|
+
// ...(params?.editorState ? { editorState: params.editorState } : {}),
|
|
547
547
|
editable: (params == null ? void 0 : params.readOnly) !== true,
|
|
548
548
|
namespace: "MDXEditor",
|
|
549
549
|
nodes: r.getValue(usedLexicalNodes$),
|
|
@@ -552,24 +552,26 @@ const corePlugin = realmPlugin({
|
|
|
552
552
|
},
|
|
553
553
|
theme: r.getValue(lexicalTheme$)
|
|
554
554
|
});
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
if (autoFocusValue
|
|
555
|
+
if ((params == null ? void 0 : params.editorState) !== null) {
|
|
556
|
+
newEditor.update(() => {
|
|
557
|
+
const markdown = (params == null ? void 0 : params.initialMarkdown.trim()) ?? "";
|
|
558
|
+
tryImportingMarkdown(r, $getRoot(), markdown);
|
|
559
|
+
const autoFocusValue = params == null ? void 0 : params.autoFocus;
|
|
560
|
+
if (autoFocusValue) {
|
|
561
|
+
if (autoFocusValue === true) {
|
|
562
|
+
setTimeout(() => {
|
|
563
|
+
newEditor.focus(noop, { defaultSelection: "rootStart" });
|
|
564
|
+
});
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
561
567
|
setTimeout(() => {
|
|
562
|
-
newEditor.focus(noop, {
|
|
568
|
+
newEditor.focus(noop, {
|
|
569
|
+
defaultSelection: autoFocusValue.defaultSelection ?? "rootStart"
|
|
570
|
+
});
|
|
563
571
|
});
|
|
564
|
-
return;
|
|
565
572
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
defaultSelection: autoFocusValue.defaultSelection ?? "rootStart"
|
|
569
|
-
});
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
});
|
|
573
|
+
});
|
|
574
|
+
}
|
|
573
575
|
r.pub(rootEditor$, newEditor);
|
|
574
576
|
r.pub(activeEditor$, newEditor);
|
|
575
577
|
},
|