@mdxeditor/editor 0.22.3 → 0.22.4
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
|
@@ -8,7 +8,7 @@ import { ContentEditable } from "@lexical/react/LexicalContentEditable.js";
|
|
|
8
8
|
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary.js";
|
|
9
9
|
import classNames from "classnames";
|
|
10
10
|
import { noop } from "./utils/fp.js";
|
|
11
|
-
import { RealmPluginInitializer } from "./gurx/react.js";
|
|
11
|
+
import { RealmPluginInitializer, useHasPlugin } from "./gurx/react.js";
|
|
12
12
|
const LexicalProvider = ({ children }) => {
|
|
13
13
|
const [initialRootEditorState, nodes, readOnly] = corePluginHooks.useEmitterValues(
|
|
14
14
|
"initialRootEditorState",
|
|
@@ -79,11 +79,17 @@ const EditorRootElement = ({ children, className }) => {
|
|
|
79
79
|
};
|
|
80
80
|
const Methods = ({ mdxRef }) => {
|
|
81
81
|
const realm = corePluginHooks.useRealmContext();
|
|
82
|
+
const hasDiffSourcePlugin = useHasPlugin("diff-source");
|
|
82
83
|
React__default.useImperativeHandle(
|
|
83
84
|
mdxRef,
|
|
84
85
|
() => {
|
|
85
86
|
return {
|
|
86
87
|
getMarkdown: () => {
|
|
88
|
+
if (hasDiffSourcePlugin) {
|
|
89
|
+
if (realm.getKeyValue("viewMode") === "source") {
|
|
90
|
+
return realm.getKeyValue("markdownSourceEditorValue");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
87
93
|
return realm.getKeyValue("markdown");
|
|
88
94
|
},
|
|
89
95
|
setMarkdown: (markdown) => {
|
|
@@ -95,7 +101,7 @@ const Methods = ({ mdxRef }) => {
|
|
|
95
101
|
}
|
|
96
102
|
};
|
|
97
103
|
},
|
|
98
|
-
[realm]
|
|
104
|
+
[realm, hasDiffSourcePlugin]
|
|
99
105
|
);
|
|
100
106
|
return null;
|
|
101
107
|
};
|
|
@@ -296,7 +296,7 @@ diffSourcePluginHooks: {
|
|
|
296
296
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
297
297
|
onBlur: RealmNode<FocusEvent>;
|
|
298
298
|
}>;
|
|
299
|
-
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "
|
|
299
|
+
useEmitter: <K extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "markdownSourceEditorValue" | "viewMode" | "diffMarkdown">(key: K, callback: (value: ValueForKey<{
|
|
300
300
|
viewMode: RealmNode<ViewMode>;
|
|
301
301
|
diffMarkdown: RealmNode<string>;
|
|
302
302
|
markdownSourceEditorValue: RealmNode<string>;
|
|
@@ -523,7 +523,7 @@ diffSourcePluginHooks: {
|
|
|
523
523
|
insertDecoratorNode: RealmNode<() => DecoratorNode<unknown>>;
|
|
524
524
|
onBlur: RealmNode<FocusEvent>;
|
|
525
525
|
}>) => void;
|
|
526
|
-
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "
|
|
526
|
+
usePublisher: <K_2 extends "jsxComponentDescriptors" | "jsxIsAvailable" | "toMarkdownOptions" | "toMarkdownExtensions" | "mdastExtensions" | "syntaxExtensions" | "markdown" | "activeEditor" | "inFocus" | "historyState" | "currentSelection" | "initialRootEditorState" | "rootEditor" | "createRootEditorSubscription" | "createActiveEditorSubscription" | "importVisitors" | "usedLexicalNodes" | "addImportVisitor" | "addLexicalNode" | "addSyntaxExtension" | "addMdastExtension" | "addToMarkdownExtension" | "addExportVisitor" | "exportVisitors" | "initialMarkdown" | "setMarkdown" | "editorRootElementRef" | "contentEditableClassName" | "placeholder" | "autoFocus" | "readOnly" | "composerChildren" | "addComposerChild" | "topAreaChildren" | "addTopAreaChild" | "nestedEditorChildren" | "addNestedEditorChild" | "editorWrappers" | "addEditorWrapper" | "currentFormat" | "editorInFocus" | "applyFormat" | "currentBlockType" | "applyBlockType" | "convertSelectionToNode" | "insertDecoratorNode" | "onBlur" | "markdownSourceEditorValue" | "viewMode" | "diffMarkdown">(key: K_2) => (value: ValueForKey<{
|
|
527
527
|
viewMode: RealmNode<ViewMode>;
|
|
528
528
|
diffMarkdown: RealmNode<string>;
|
|
529
529
|
markdownSourceEditorValue: RealmNode<string>;
|