@mdxeditor/editor 3.18.0 → 3.19.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
@@ -1,7 +1,7 @@
1
- import { useCellValue, useCellValues, usePublisher, useRealm } from "@mdxeditor/gurx";
1
+ import { useCellValue, usePublisher, useCellValues, useRealm } from "@mdxeditor/gurx";
2
2
  import React__default from "react";
3
3
  import { RealmWithPlugins } from "./RealmWithPlugins.js";
4
- import { corePlugin, rootEditor$, useTranslation, contentEditableClassName$, spellCheck$, composerChildren$, topAreaChildren$, editorWrappers$, placeholder$, editorRootElementRef$, viewMode$, markdownSourceEditorValue$, markdown$, setMarkdown$, insertMarkdown$ } from "./plugins/core/index.js";
4
+ import { corePlugin, rootEditor$, useTranslation, contentEditableRef$, contentEditableClassName$, spellCheck$, composerChildren$, topAreaChildren$, editorWrappers$, placeholder$, editorRootElementRef$, viewMode$, markdownSourceEditorValue$, markdown$, setMarkdown$, insertMarkdown$ } from "./plugins/core/index.js";
5
5
  import { ContentEditable } from "@lexical/react/LexicalContentEditable.js";
6
6
  import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary.js";
7
7
  import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin.js";
@@ -20,6 +20,10 @@ const LexicalProvider = ({ children }) => {
20
20
  };
21
21
  const RichTextEditor = () => {
22
22
  const t = useTranslation();
23
+ const setContentEditableRef = usePublisher(contentEditableRef$);
24
+ const onRef = (_contentEditableRef) => {
25
+ setContentEditableRef({ current: _contentEditableRef });
26
+ };
23
27
  const [contentEditableClassName, spellCheck, composerChildren, topAreaChildren, editorWrappers, placeholder] = useCellValues(
24
28
  contentEditableClassName$,
25
29
  spellCheck$,
@@ -31,14 +35,14 @@ const RichTextEditor = () => {
31
35
  return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, topAreaChildren.map((Child, index) => /* @__PURE__ */ React__default.createElement(Child, { key: index })), /* @__PURE__ */ React__default.createElement(RenderRecursiveWrappers, { wrappers: editorWrappers }, /* @__PURE__ */ React__default.createElement("div", { className: classNames(styles.rootContentEditableWrapper, "mdxeditor-root-contenteditable") }, /* @__PURE__ */ React__default.createElement(
32
36
  RichTextPlugin,
33
37
  {
34
- contentEditable: /* @__PURE__ */ React__default.createElement(
38
+ contentEditable: /* @__PURE__ */ React__default.createElement("div", { ref: onRef }, /* @__PURE__ */ React__default.createElement(
35
39
  ContentEditable,
36
40
  {
37
41
  className: classNames(styles.contentEditable, contentEditableClassName),
38
42
  ariaLabel: t("contentArea.editableMarkdown", "editable markdown"),
39
43
  spellCheck
40
44
  }
41
- ),
45
+ )),
42
46
  placeholder: /* @__PURE__ */ React__default.createElement("div", { className: classNames(styles.contentEditable, styles.placeholder, contentEditableClassName) }, /* @__PURE__ */ React__default.createElement("p", null, placeholder)),
43
47
  ErrorBoundary: LexicalErrorBoundary
44
48
  }
package/dist/index.d.ts CHANGED
@@ -632,6 +632,12 @@ export declare interface ConditionalContentsOption {
632
632
  */
633
633
  export declare const contentEditableClassName$: NodeRef<string>;
634
634
 
635
+ /**
636
+ * A reference to the content editable element.
637
+ * @group Core
638
+ */
639
+ export declare const contentEditableRef$: NodeRef<default_2.RefObject<HTMLDivElement> | null>;
640
+
635
641
  /**
636
642
  * Returns true if the user is pressing the control key on Windows or the meta key on Mac.
637
643
  * @group Utils
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { MDXEditor } from "./MDXEditor.js";
4
4
  import { defaultSvgIcons } from "./defaultSvgIcons.js";
5
5
  import { MarkdownParseError, UnrecognizedMarkdownConstructError, importMarkdownToLexical, importMdastTreeToLexical } from "./importMarkdownToLexical.js";
6
6
  import { exportLexicalTreeToMdast, exportMarkdownFromLexical } from "./exportMarkdownFromLexical.js";
7
- import { Appender, NESTED_EDITOR_UPDATED_COMMAND, activeEditor$, activeEditorSubscriptions$, activePlugins$, addActivePlugin$, addComposerChild$, addEditorWrapper$, addExportVisitor$, addImportVisitor$, addLexicalNode$, addMdastExtension$, addNestedEditorChild$, addSyntaxExtension$, addToMarkdownExtension$, addTopAreaChild$, applyBlockType$, applyFormat$, autoFocus$, codeBlockEditorDescriptors$, composerChildren$, contentEditableClassName$, convertSelectionToNode$, corePlugin, createActiveEditorSubscription$, createRootEditorSubscription$, currentBlockType$, currentFormat$, currentSelection$, directiveDescriptors$, editorInFocus$, editorRootElementRef$, editorWrappers$, exportVisitors$, historyState$, iconComponentFor$, importVisitors$, inFocus$, initialMarkdown$, insertDecoratorNode$, insertMarkdown$, jsxComponentDescriptors$, jsxIsAvailable$, lexicalTheme$, markdown$, markdownErrorSignal$, markdownProcessingError$, markdownSourceEditorValue$, mdastExtensions$, muteChange$, nestedEditorChildren$, onBlur$, placeholder$, readOnly$, rootEditor$, rootEditorSubscriptions$, setMarkdown$, spellCheck$, syntaxExtensions$, toMarkdownExtensions$, toMarkdownOptions$, topAreaChildren$, translation$, useTranslation, usedLexicalNodes$, viewMode$ } from "./plugins/core/index.js";
7
+ import { Appender, NESTED_EDITOR_UPDATED_COMMAND, activeEditor$, activeEditorSubscriptions$, activePlugins$, addActivePlugin$, addComposerChild$, addEditorWrapper$, addExportVisitor$, addImportVisitor$, addLexicalNode$, addMdastExtension$, addNestedEditorChild$, addSyntaxExtension$, addToMarkdownExtension$, addTopAreaChild$, applyBlockType$, applyFormat$, autoFocus$, codeBlockEditorDescriptors$, composerChildren$, contentEditableClassName$, contentEditableRef$, convertSelectionToNode$, corePlugin, createActiveEditorSubscription$, createRootEditorSubscription$, currentBlockType$, currentFormat$, currentSelection$, directiveDescriptors$, editorInFocus$, editorRootElementRef$, editorWrappers$, exportVisitors$, historyState$, iconComponentFor$, importVisitors$, inFocus$, initialMarkdown$, insertDecoratorNode$, insertMarkdown$, jsxComponentDescriptors$, jsxIsAvailable$, lexicalTheme$, markdown$, markdownErrorSignal$, markdownProcessingError$, markdownSourceEditorValue$, mdastExtensions$, muteChange$, nestedEditorChildren$, onBlur$, placeholder$, readOnly$, rootEditor$, rootEditorSubscriptions$, setMarkdown$, spellCheck$, syntaxExtensions$, toMarkdownExtensions$, toMarkdownOptions$, topAreaChildren$, translation$, useTranslation, usedLexicalNodes$, viewMode$ } from "./plugins/core/index.js";
8
8
  import { ALL_HEADING_LEVELS, allowedHeadingLevels$, headingsPlugin } from "./plugins/headings/index.js";
9
9
  import { insertThematicBreak$, thematicBreakPlugin } from "./plugins/thematic-break/index.js";
10
10
  import { applyListType$, currentListType$, listsPlugin } from "./plugins/lists/index.js";
@@ -189,6 +189,7 @@ export {
189
189
  compose,
190
190
  composerChildren$,
191
191
  contentEditableClassName$,
192
+ contentEditableRef$,
192
193
  controlOrMeta,
193
194
  convertSelectionToNode$,
194
195
  corePlugin,
@@ -108,6 +108,7 @@ const jsxComponentDescriptors$ = Cell([]);
108
108
  const directiveDescriptors$ = Cell([]);
109
109
  const codeBlockEditorDescriptors$ = Cell([]);
110
110
  const editorRootElementRef$ = Cell(null);
111
+ const contentEditableRef$ = Cell(null);
111
112
  const addLexicalNode$ = Appender(usedLexicalNodes$);
112
113
  const addImportVisitor$ = Appender(importVisitors$);
113
114
  const addSyntaxExtension$ = Appender(syntaxExtensions$);
@@ -592,6 +593,7 @@ export {
592
593
  codeBlockEditorDescriptors$,
593
594
  composerChildren$,
594
595
  contentEditableClassName$,
596
+ contentEditableRef$,
595
597
  convertSelectionToNode$,
596
598
  corePlugin,
597
599
  createActiveEditorSubscription$,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "*.css"
12
12
  ],
13
13
  "type": "module",
14
- "version": "3.18.0",
14
+ "version": "3.19.0",
15
15
  "description": "React component for rich text markdown editing",
16
16
  "scripts": {
17
17
  "build": "vite build",