@mdxeditor/editor 3.17.0 → 3.17.1
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.
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { $addUpdateTag, $getNodeByKey, createEditor, $getRoot, FOCUS_COMMAND, COMMAND_PRIORITY_LOW, BLUR_COMMAND, COMMAND_PRIORITY_EDITOR, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_HIGH, KEY_BACKSPACE_COMMAND, COMMAND_PRIORITY_CRITICAL } from "lexical";
|
|
2
2
|
import React__default from "react";
|
|
3
|
-
import { NESTED_EDITOR_UPDATED_COMMAND, rootEditor$, importVisitors$, exportVisitors$, usedLexicalNodes$, jsxComponentDescriptors$, directiveDescriptors$, codeBlockEditorDescriptors$, jsxIsAvailable$, nestedEditorChildren$, editorInFocus$ } from "./index.js";
|
|
3
|
+
import { NESTED_EDITOR_UPDATED_COMMAND, rootEditor$, importVisitors$, exportVisitors$, usedLexicalNodes$, jsxComponentDescriptors$, directiveDescriptors$, codeBlockEditorDescriptors$, jsxIsAvailable$, nestedEditorChildren$, lexicalTheme$, editorInFocus$ } from "./index.js";
|
|
4
4
|
import { ContentEditable } from "@lexical/react/LexicalContentEditable.js";
|
|
5
5
|
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary.js";
|
|
6
6
|
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer.js";
|
|
7
7
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
8
8
|
import classNames from "classnames";
|
|
9
|
-
import { lexicalTheme } from "../../styles/lexicalTheme.js";
|
|
10
9
|
import { exportLexicalTreeToMdast } from "../../exportMarkdownFromLexical.js";
|
|
11
10
|
import { importMdastTreeToLexical } from "../../importMarkdownToLexical.js";
|
|
12
11
|
import styles from "../../styles/ui.module.css.js";
|
|
13
12
|
import { SharedHistoryPlugin } from "./SharedHistoryPlugin.js";
|
|
14
13
|
import { mergeRegister } from "@lexical/utils";
|
|
15
14
|
import { isPartOftheEditorUI } from "../../utils/isPartOftheEditorUI.js";
|
|
16
|
-
import { useCellValues, usePublisher } from "@mdxeditor/gurx";
|
|
15
|
+
import { useRealm, useCellValues, usePublisher } from "@mdxeditor/gurx";
|
|
17
16
|
const NestedEditorsContext = React__default.createContext(void 0);
|
|
18
17
|
function useNestedEditorContext() {
|
|
19
18
|
const context = React__default.useContext(NestedEditorsContext);
|
|
@@ -54,6 +53,7 @@ const NestedLexicalEditor = function(props) {
|
|
|
54
53
|
const updateMdastNode = useMdastNodeUpdater();
|
|
55
54
|
const removeNode = useLexicalNodeRemove();
|
|
56
55
|
const content = getContent(mdastNode);
|
|
56
|
+
const realm = useRealm();
|
|
57
57
|
const [
|
|
58
58
|
rootEditor,
|
|
59
59
|
importVisitors,
|
|
@@ -63,7 +63,8 @@ const NestedLexicalEditor = function(props) {
|
|
|
63
63
|
directiveDescriptors,
|
|
64
64
|
codeBlockEditorDescriptors,
|
|
65
65
|
jsxIsAvailable,
|
|
66
|
-
nestedEditorChildren
|
|
66
|
+
nestedEditorChildren,
|
|
67
|
+
lexicalTheme
|
|
67
68
|
] = useCellValues(
|
|
68
69
|
rootEditor$,
|
|
69
70
|
importVisitors$,
|
|
@@ -73,13 +74,14 @@ const NestedLexicalEditor = function(props) {
|
|
|
73
74
|
directiveDescriptors$,
|
|
74
75
|
codeBlockEditorDescriptors$,
|
|
75
76
|
jsxIsAvailable$,
|
|
76
|
-
nestedEditorChildren
|
|
77
|
+
nestedEditorChildren$,
|
|
78
|
+
lexicalTheme$
|
|
77
79
|
);
|
|
78
80
|
const setEditorInFocus = usePublisher(editorInFocus$);
|
|
79
81
|
const [editor] = React__default.useState(() => {
|
|
80
82
|
const editor2 = createEditor({
|
|
81
83
|
nodes: usedLexicalNodes,
|
|
82
|
-
theme: lexicalTheme
|
|
84
|
+
theme: realm.getValue(lexicalTheme$)
|
|
83
85
|
});
|
|
84
86
|
return editor2;
|
|
85
87
|
});
|
|
@@ -192,7 +194,7 @@ const NestedLexicalEditor = function(props) {
|
|
|
192
194
|
updateMdastNode,
|
|
193
195
|
rootEditor
|
|
194
196
|
]);
|
|
195
|
-
return /* @__PURE__ */ React__default.createElement(LexicalNestedComposer, { initialEditor: editor }, /* @__PURE__ */ React__default.createElement(
|
|
197
|
+
return /* @__PURE__ */ React__default.createElement(LexicalNestedComposer, { initialEditor: editor, initialTheme: lexicalTheme }, /* @__PURE__ */ React__default.createElement(
|
|
196
198
|
RichTextPlugin,
|
|
197
199
|
{
|
|
198
200
|
contentEditable: /* @__PURE__ */ React__default.createElement(ContentEditable, { ...contentEditableProps, className: classNames(styles.nestedEditor, contentEditableProps == null ? void 0 : contentEditableProps.className) }),
|