@mdxeditor/editor 3.45.1 → 3.46.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.js +7 -5
- package/dist/index.d.ts +13 -2
- package/dist/plugins/core/index.js +2 -2
- package/package.json +1 -1
package/dist/MDXEditor.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { usePublisher, useCellValue, useCellValues, useRealm } from "@mdxeditor/gurx";
|
|
2
2
|
import React__default from "react";
|
|
3
|
-
import { RealmWithPlugins } from "./RealmWithPlugins.js";
|
|
4
3
|
import { corePlugin, editorRootElementRef$, rootEditor$, useTranslation, contentEditableRef$, contentEditableClassName$, spellCheck$, composerChildren$, topAreaChildren$, editorWrappers$, placeholder$, bottomAreaChildren$, insertMarkdown$, setMarkdown$, viewMode$, markdownSourceEditorValue$, markdown$ } from "./plugins/core/index.js";
|
|
4
|
+
import { RealmWithPlugins } from "./RealmWithPlugins.js";
|
|
5
|
+
import { createLexicalComposerContext, LexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
5
6
|
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
7
|
+
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
6
8
|
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
7
9
|
import classNames from "classnames";
|
|
10
|
+
import { defaultSvgIcons } from "./defaultSvgIcons.js";
|
|
8
11
|
import { lexicalTheme } from "./styles/lexicalTheme.js";
|
|
9
12
|
import styles from "./styles/ui.module.css.js";
|
|
10
13
|
import { noop } from "./utils/fp.js";
|
|
11
|
-
import { createLexicalComposerContext, LexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
12
|
-
import { defaultSvgIcons } from "./defaultSvgIcons.js";
|
|
13
|
-
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
14
14
|
const LexicalProvider = ({ children }) => {
|
|
15
15
|
const rootEditor = useCellValue(rootEditor$);
|
|
16
16
|
const composerContextValue = React__default.useMemo(() => {
|
|
@@ -141,7 +141,9 @@ const MDXEditor = React__default.forwardRef((props, ref) => {
|
|
|
141
141
|
trim: props.trim ?? true,
|
|
142
142
|
lexicalTheme: props.lexicalTheme,
|
|
143
143
|
..."editorState" in props ? { editorState: props.editorState } : {},
|
|
144
|
-
suppressSharedHistory: props.suppressSharedHistory ?? false
|
|
144
|
+
suppressSharedHistory: props.suppressSharedHistory ?? false,
|
|
145
|
+
additionalLexicalNodes: props.additionalLexicalNodes ?? [],
|
|
146
|
+
lexicalEditorNamespace: props.lexicalEditorNamespace ?? "MDXEditor"
|
|
145
147
|
}),
|
|
146
148
|
...props.plugins ?? []
|
|
147
149
|
]
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import * as lexical from 'lexical';
|
|
|
22
22
|
import { LexicalCommand } from 'lexical';
|
|
23
23
|
import { LexicalEditor } from 'lexical';
|
|
24
24
|
import { LexicalNode } from 'lexical';
|
|
25
|
+
import { LexicalNodeReplacement } from 'lexical';
|
|
25
26
|
import { LinkNode } from '@lexical/link';
|
|
26
27
|
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
27
28
|
import { ListType } from '@lexical/list';
|
|
@@ -202,11 +203,13 @@ export declare const addExportVisitor$: NodeRef< LexicalVisitor | LexicalVisitor
|
|
|
202
203
|
*/
|
|
203
204
|
export declare const addImportVisitor$: NodeRef<MdastImportVisitor<Mdast.Nodes> | MdastImportVisitor<Mdast.Nodes>[]>;
|
|
204
205
|
|
|
206
|
+
export declare type AdditionalLexicalNode = KlassConstructor<typeof LexicalNode> | LexicalNodeReplacement;
|
|
207
|
+
|
|
205
208
|
/**
|
|
206
209
|
* Registers a lexical node to be used in the editor.
|
|
207
210
|
* @group Core
|
|
208
211
|
*/
|
|
209
|
-
export declare const addLexicalNode$: NodeRef<
|
|
212
|
+
export declare const addLexicalNode$: NodeRef<KlassConstructor<typeof LexicalNode> | KlassConstructor<typeof LexicalNode>[]>;
|
|
210
213
|
|
|
211
214
|
/**
|
|
212
215
|
* Adds a mdast extension to the markdown parser.
|
|
@@ -2311,6 +2314,14 @@ export declare interface MDXEditorProps {
|
|
|
2311
2314
|
* The initial state of the lexical editor. Pass null to disable any initiation.
|
|
2312
2315
|
*/
|
|
2313
2316
|
editorState?: EditorState | undefined | null;
|
|
2317
|
+
/**
|
|
2318
|
+
* Additional lexical nodes to include in the editor.
|
|
2319
|
+
*/
|
|
2320
|
+
additionalLexicalNodes?: AdditionalLexicalNode[];
|
|
2321
|
+
/**
|
|
2322
|
+
* The lexical editor namespace.
|
|
2323
|
+
*/
|
|
2324
|
+
lexicalEditorNamespace?: string;
|
|
2314
2325
|
}
|
|
2315
2326
|
|
|
2316
2327
|
/**
|
|
@@ -3041,7 +3052,7 @@ export declare function useCodeBlockEditorContext(): CodeBlockEditorContextValue
|
|
|
3041
3052
|
* Contains the currently registered lexical nodes.
|
|
3042
3053
|
* @group Core
|
|
3043
3054
|
*/
|
|
3044
|
-
export declare const usedLexicalNodes$: NodeRef<
|
|
3055
|
+
export declare const usedLexicalNodes$: NodeRef<KlassConstructor<typeof LexicalNode>[]>;
|
|
3045
3056
|
|
|
3046
3057
|
export declare function useEditorSearch(): {
|
|
3047
3058
|
next: () => void;
|
|
@@ -545,8 +545,8 @@ const corePlugin = realmPlugin({
|
|
|
545
545
|
const newEditor = createEditor({
|
|
546
546
|
// ...(params?.editorState ? { editorState: params.editorState } : {}),
|
|
547
547
|
editable: (params == null ? void 0 : params.readOnly) !== true,
|
|
548
|
-
namespace: "MDXEditor",
|
|
549
|
-
nodes: r.getValue(usedLexicalNodes$),
|
|
548
|
+
namespace: (params == null ? void 0 : params.lexicalEditorNamespace) ?? "MDXEditor",
|
|
549
|
+
nodes: [...r.getValue(usedLexicalNodes$), ...(params == null ? void 0 : params.additionalLexicalNodes) ?? []],
|
|
550
550
|
onError: (error) => {
|
|
551
551
|
throw error;
|
|
552
552
|
},
|