@mdxeditor/editor 3.42.0 → 3.44.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 CHANGED
@@ -139,7 +139,9 @@ const MDXEditor = React__default.forwardRef((props, ref) => {
139
139
  onError: props.onError ?? noop,
140
140
  translation: props.translation ?? defaultTranslation,
141
141
  trim: props.trim ?? true,
142
- lexicalTheme: props.lexicalTheme
142
+ lexicalTheme: props.lexicalTheme,
143
+ ..."editorState" in props ? { editorState: props.editorState } : {},
144
+ suppressSharedHistory: props.suppressSharedHistory ?? false
143
145
  }),
144
146
  ...props.plugins ?? []
145
147
  ]
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ import { DOMConversionMap } from 'lexical';
9
9
  import { DOMConversionOutput } from 'lexical';
10
10
  import { DOMExportOutput } from 'lexical';
11
11
  import { EditorConfig } from 'lexical';
12
+ import { EditorState } from 'lexical';
12
13
  import { EditorThemeClasses } from 'lexical';
13
14
  import { ElementNode } from 'lexical';
14
15
  import { Extension } from 'micromark-util-types';
@@ -2301,6 +2302,14 @@ export declare interface MDXEditorProps {
2301
2302
  * Defaults to document.body.
2302
2303
  */
2303
2304
  overlayContainer?: HTMLElement | null;
2305
+ /**
2306
+ * Certain collaboration plugins require that the history is disabled for the editor.
2307
+ */
2308
+ suppressSharedHistory?: boolean;
2309
+ /**
2310
+ * The initial state of the lexical editor.
2311
+ */
2312
+ editorState?: EditorState | undefined;
2304
2313
  }
2305
2314
 
2306
2315
  /**
@@ -81,7 +81,8 @@ const NestedLexicalEditor = function(props) {
81
81
  const [editor] = React__default.useState(() => {
82
82
  const editor2 = createEditor({
83
83
  nodes: usedLexicalNodes,
84
- theme: realm.getValue(lexicalTheme$)
84
+ theme: realm.getValue(lexicalTheme$),
85
+ namespace: "NestedEditor"
85
86
  });
86
87
  return editor2;
87
88
  });
@@ -510,7 +510,6 @@ const corePlugin = realmPlugin({
510
510
  LexicalLinebreakVisitor,
511
511
  LexicalGenericHTMLVisitor
512
512
  ],
513
- [addComposerChild$]: SharedHistoryPlugin,
514
513
  [contentEditableClassName$]: params == null ? void 0 : params.contentEditableClassName,
515
514
  [spellCheck$]: params == null ? void 0 : params.spellCheck,
516
515
  [toMarkdownOptions$]: params == null ? void 0 : params.toMarkdownOptions,
@@ -535,9 +534,13 @@ const corePlugin = realmPlugin({
535
534
  [addImportVisitor$]: MdastHTMLVisitor
536
535
  });
537
536
  }
537
+ if (!(params == null ? void 0 : params.suppressSharedHistory)) {
538
+ r.pub(addComposerChild$, SharedHistoryPlugin);
539
+ }
538
540
  },
539
541
  postInit(r, params) {
540
542
  const newEditor = createEditor({
543
+ ...(params == null ? void 0 : params.editorState) ? { editorState: params.editorState } : {},
541
544
  editable: (params == null ? void 0 : params.readOnly) !== true,
542
545
  namespace: "MDXEditor",
543
546
  nodes: r.getValue(usedLexicalNodes$),
@@ -232,7 +232,8 @@ const CellEditor = ({ focus, setActiveCell, parentEditor, lexicalTable, contents
232
232
  const [editor] = React__default.useState(() => {
233
233
  const editor2 = createEditor({
234
234
  nodes: usedLexicalNodes,
235
- theme: lexicalTheme
235
+ theme: lexicalTheme,
236
+ namespace: "TableCellEditor"
236
237
  });
237
238
  editor2.update(() => {
238
239
  importMdastTreeToLexical({
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.42.0",
14
+ "version": "3.44.0",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",
@@ -44,15 +44,15 @@
44
44
  "@codemirror/state": "^6.4.0",
45
45
  "@codemirror/view": "^6.23.0",
46
46
  "@codesandbox/sandpack-react": "^2.20.0",
47
- "@lexical/clipboard": "^0.33.1",
48
- "@lexical/link": "^0.33.1",
49
- "@lexical/list": "^0.33.1",
50
- "@lexical/markdown": "^0.33.1",
51
- "@lexical/plain-text": "^0.33.1",
52
- "@lexical/react": "^0.33.1",
53
- "@lexical/rich-text": "^0.33.1",
54
- "@lexical/selection": "^0.33.1",
55
- "@lexical/utils": "^0.33.1",
47
+ "@lexical/clipboard": "^0.35.0",
48
+ "@lexical/link": "^0.35.0",
49
+ "@lexical/list": "^0.35.0",
50
+ "@lexical/markdown": "^0.35.0",
51
+ "@lexical/plain-text": "^0.35.0",
52
+ "@lexical/react": "^0.35.0",
53
+ "@lexical/rich-text": "^0.35.0",
54
+ "@lexical/selection": "^0.35.0",
55
+ "@lexical/utils": "^0.35.0",
56
56
  "@mdxeditor/gurx": "^1.1.4",
57
57
  "@radix-ui/colors": "^3.0.0",
58
58
  "@radix-ui/react-dialog": "^1.1.11",
@@ -68,7 +68,7 @@
68
68
  "codemirror": "^6.0.1",
69
69
  "downshift": "^7.6.0",
70
70
  "js-yaml": "4.1.0",
71
- "lexical": "^0.33.1",
71
+ "lexical": "^0.35.0",
72
72
  "mdast-util-directive": "^3.0.0",
73
73
  "mdast-util-from-markdown": "^2.0.0",
74
74
  "mdast-util-frontmatter": "^2.0.1",