@mdxeditor/editor 3.46.0 → 3.46.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.
package/dist/index.d.ts
CHANGED
|
@@ -2355,7 +2355,11 @@ export declare const muteChange$: NodeRef<boolean>;
|
|
|
2355
2355
|
|
|
2356
2356
|
export declare const NESTED_EDITOR_UPDATED_COMMAND: LexicalCommand<undefined>;
|
|
2357
2357
|
|
|
2358
|
-
|
|
2358
|
+
/**
|
|
2359
|
+
* React Components registered to be rendered inside `LexicalNestedComposer`. Useful if you're using lexical editor plugins that are wrapped as react components.
|
|
2360
|
+
* @group Core
|
|
2361
|
+
*/
|
|
2362
|
+
export declare const nestedEditorChildren$: NodeRef<default_2.ComponentType<{}>[]>;
|
|
2359
2363
|
|
|
2360
2364
|
/**
|
|
2361
2365
|
* Use this context to provide the necessary values to the {@link NestedLexicalEditor} React component.
|
|
@@ -6,19 +6,21 @@ import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin";
|
|
|
6
6
|
import { LexicalAutoLinkPlugin } from "./AutoLinkPlugin.js";
|
|
7
7
|
import { Cell } from "@mdxeditor/gurx";
|
|
8
8
|
import { realmPlugin } from "../../RealmWithPlugins.js";
|
|
9
|
-
import { addComposerChild$, addExportVisitor$, addLexicalNode$, addImportVisitor$, addActivePlugin$ } from "../core/index.js";
|
|
9
|
+
import { addComposerChild$, addNestedEditorChild$, addExportVisitor$, addLexicalNode$, addImportVisitor$, addActivePlugin$ } from "../core/index.js";
|
|
10
10
|
const disableAutoLink$ = Cell(false);
|
|
11
11
|
const linkPlugin = realmPlugin({
|
|
12
12
|
init(realm, params) {
|
|
13
13
|
const disableAutoLink = Boolean(params == null ? void 0 : params.disableAutoLink);
|
|
14
14
|
const linkPluginProps = (params == null ? void 0 : params.validateUrl) ? { validateUrl: params.validateUrl } : {};
|
|
15
|
+
const EditorChild = () => /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, /* @__PURE__ */ React__default.createElement(LinkPlugin, { ...linkPluginProps }), disableAutoLink ? null : /* @__PURE__ */ React__default.createElement(LexicalAutoLinkPlugin, null));
|
|
15
16
|
realm.pubIn({
|
|
16
17
|
[addActivePlugin$]: "link",
|
|
17
18
|
[addImportVisitor$]: MdastLinkVisitor,
|
|
18
19
|
[addLexicalNode$]: [LinkNode, AutoLinkNode],
|
|
19
20
|
[addExportVisitor$]: LexicalLinkVisitor,
|
|
20
21
|
[disableAutoLink$]: disableAutoLink,
|
|
21
|
-
[
|
|
22
|
+
[addNestedEditorChild$]: EditorChild,
|
|
23
|
+
[addComposerChild$]: EditorChild
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
26
|
});
|
|
@@ -15,7 +15,7 @@ import classNames from "classnames";
|
|
|
15
15
|
import styles from "../../styles/ui.module.css.js";
|
|
16
16
|
import { isPartOftheEditorUI } from "../../utils/isPartOftheEditorUI.js";
|
|
17
17
|
import { uuidv4 } from "../../utils/uuid4.js";
|
|
18
|
-
import { iconComponentFor$, readOnly$, useTranslation, editorRootElementRef$, importVisitors$, exportVisitors$, usedLexicalNodes$, jsxComponentDescriptors$, directiveDescriptors$, codeBlockEditorDescriptors$, jsxIsAvailable$, rootEditor$, NESTED_EDITOR_UPDATED_COMMAND } from "../core/index.js";
|
|
18
|
+
import { iconComponentFor$, readOnly$, useTranslation, editorRootElementRef$, importVisitors$, exportVisitors$, usedLexicalNodes$, jsxComponentDescriptors$, directiveDescriptors$, codeBlockEditorDescriptors$, jsxIsAvailable$, rootEditor$, nestedEditorChildren$, NESTED_EDITOR_UPDATED_COMMAND } from "../core/index.js";
|
|
19
19
|
import { useCellValues } from "@mdxeditor/gurx";
|
|
20
20
|
const getCellType = (rowIndex) => {
|
|
21
21
|
if (rowIndex === 0) {
|
|
@@ -218,7 +218,8 @@ const CellEditor = ({ focus, setActiveCell, parentEditor, lexicalTable, contents
|
|
|
218
218
|
directiveDescriptors,
|
|
219
219
|
codeBlockEditorDescriptors,
|
|
220
220
|
jsxIsAvailable,
|
|
221
|
-
rootEditor
|
|
221
|
+
rootEditor,
|
|
222
|
+
nestedEditorChildren
|
|
222
223
|
] = useCellValues(
|
|
223
224
|
importVisitors$,
|
|
224
225
|
exportVisitors$,
|
|
@@ -227,7 +228,8 @@ const CellEditor = ({ focus, setActiveCell, parentEditor, lexicalTable, contents
|
|
|
227
228
|
directiveDescriptors$,
|
|
228
229
|
codeBlockEditorDescriptors$,
|
|
229
230
|
jsxIsAvailable$,
|
|
230
|
-
rootEditor
|
|
231
|
+
rootEditor$,
|
|
232
|
+
nestedEditorChildren$
|
|
231
233
|
);
|
|
232
234
|
const [editor] = React__default.useState(() => {
|
|
233
235
|
const editor2 = createEditor({
|
|
@@ -323,7 +325,7 @@ const CellEditor = ({ focus, setActiveCell, parentEditor, lexicalTable, contents
|
|
|
323
325
|
React__default.useEffect(() => {
|
|
324
326
|
focus && editor.focus();
|
|
325
327
|
}, [focus, editor]);
|
|
326
|
-
return /* @__PURE__ */ React__default.createElement(LexicalNestedComposer, { initialEditor: editor }, /* @__PURE__ */ React__default.createElement(RichTextPlugin, { contentEditable: /* @__PURE__ */ React__default.createElement(ContentEditable, null), placeholder: /* @__PURE__ */ React__default.createElement("div", null), ErrorBoundary: LexicalErrorBoundary }), /* @__PURE__ */ React__default.createElement(HistoryPlugin, null));
|
|
328
|
+
return /* @__PURE__ */ React__default.createElement(LexicalNestedComposer, { initialEditor: editor }, /* @__PURE__ */ React__default.createElement(RichTextPlugin, { contentEditable: /* @__PURE__ */ React__default.createElement(ContentEditable, null), placeholder: /* @__PURE__ */ React__default.createElement("div", null), ErrorBoundary: LexicalErrorBoundary }), nestedEditorChildren.map((Child, index) => /* @__PURE__ */ React__default.createElement(Child, { key: index })), /* @__PURE__ */ React__default.createElement(HistoryPlugin, null));
|
|
327
329
|
};
|
|
328
330
|
const ColumnEditor = ({
|
|
329
331
|
parentEditor,
|