@mdxeditor/editor 3.25.0 → 3.26.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 +3 -3
- package/dist/index.d.ts +4 -5
- package/dist/plugins/core/NestedLexicalEditor.js +4 -4
- package/dist/plugins/core/SharedHistoryPlugin.js +1 -1
- package/dist/plugins/image/ImageEditor.js +2 -2
- package/dist/plugins/link/AutoLinkPlugin.js +1 -1
- package/dist/plugins/link/index.js +1 -1
- package/dist/plugins/markdown-shortcut/index.js +17 -1
- package/dist/plugins/table/TableEditor.js +5 -5
- package/dist/plugins/thematic-break/index.js +2 -1
- package/package.json +11 -11
package/dist/MDXEditor.js
CHANGED
|
@@ -2,15 +2,15 @@ import { useCellValue, usePublisher, useCellValues, useRealm } from "@mdxeditor/
|
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import { RealmWithPlugins } from "./RealmWithPlugins.js";
|
|
4
4
|
import { corePlugin, rootEditor$, useTranslation, contentEditableRef$, contentEditableClassName$, spellCheck$, composerChildren$, topAreaChildren$, editorWrappers$, placeholder$, editorRootElementRef$, viewMode$, markdownSourceEditorValue$, markdown$, setMarkdown$, insertMarkdown$ } from "./plugins/core/index.js";
|
|
5
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable
|
|
6
|
-
import
|
|
7
|
-
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin.js";
|
|
5
|
+
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
6
|
+
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
8
7
|
import classNames from "classnames";
|
|
9
8
|
import { lexicalTheme } from "./styles/lexicalTheme.js";
|
|
10
9
|
import styles from "./styles/ui.module.css.js";
|
|
11
10
|
import { noop } from "./utils/fp.js";
|
|
12
11
|
import { createLexicalComposerContext, LexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
13
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(() => {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from 'mdast-util-from-markdown/lib';
|
|
2
|
-
import { ContentEditable } from '@lexical/react/LexicalContentEditable
|
|
2
|
+
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
|
|
3
3
|
import { DecoratorNode } from 'lexical';
|
|
4
4
|
import { default as default_2 } from 'react';
|
|
5
5
|
import { Directives } from 'mdast-util-directive';
|
|
@@ -18,7 +18,7 @@ import { LexicalCommand } from 'lexical';
|
|
|
18
18
|
import { LexicalEditor } from 'lexical';
|
|
19
19
|
import { LexicalNode } from 'lexical';
|
|
20
20
|
import { LinkNode } from '@lexical/link';
|
|
21
|
-
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin
|
|
21
|
+
import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
|
|
22
22
|
import { ListType } from '@lexical/list';
|
|
23
23
|
import * as Mdast from 'mdast';
|
|
24
24
|
import { MdxJsxAttribute } from 'mdast-util-mdx-jsx';
|
|
@@ -203,7 +203,7 @@ export declare const addToMarkdownExtension$: NodeRef< Options_2 | Options_2[]>;
|
|
|
203
203
|
*/
|
|
204
204
|
export declare const addTopAreaChild$: NodeRef<default_2.ComponentType<{}> | default_2.ComponentType<{}>[]>;
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
export declare const ADMONITION_TYPES: readonly ["note", "tip", "danger", "info", "caution"];
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
209
|
* Pass this descriptor to the `directivesPlugin` `directiveDescriptors` parameter to enable {@link https://docusaurus.io/docs/markdown-features/admonitions | markdown admonitions}.
|
|
@@ -2132,8 +2132,7 @@ export declare interface MDXEditorProps {
|
|
|
2132
2132
|
*/
|
|
2133
2133
|
plugins?: RealmPlugin[];
|
|
2134
2134
|
/**
|
|
2135
|
-
* The class name to apply to the root component element
|
|
2136
|
-
* For a content-specific styling, Use `contentEditableClassName` property.
|
|
2135
|
+
* The class name to apply to the root component element, including the toolbar and the popups. For styling the content editable area, Use `contentEditableClassName` property.
|
|
2137
2136
|
*/
|
|
2138
2137
|
className?: string;
|
|
2139
2138
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { $addUpdateTag, $getNodeByKey, createEditor, $getRoot, FOCUS_COMMAND, COMMAND_PRIORITY_LOW, BLUR_COMMAND, COMMAND_PRIORITY_EDITOR, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_HIGH, KEY_BACKSPACE_COMMAND, COMMAND_PRIORITY_CRITICAL } from "lexical";
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import { NESTED_EDITOR_UPDATED_COMMAND, rootEditor$, importVisitors$, exportVisitors$, usedLexicalNodes$, jsxComponentDescriptors$, directiveDescriptors$, codeBlockEditorDescriptors$, jsxIsAvailable$, nestedEditorChildren$, lexicalTheme$, editorInFocus$ } from "./index.js";
|
|
4
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable
|
|
5
|
-
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary
|
|
6
|
-
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer
|
|
7
|
-
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin
|
|
4
|
+
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
5
|
+
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
6
|
+
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer";
|
|
7
|
+
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
8
8
|
import classNames from "classnames";
|
|
9
9
|
import { exportLexicalTreeToMdast } from "../../exportMarkdownFromLexical.js";
|
|
10
10
|
import { importMdastTreeToLexical } from "../../importMarkdownToLexical.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin
|
|
1
|
+
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import { historyState$ } from "./index.js";
|
|
4
4
|
import { useCellValue } from "@mdxeditor/gurx";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from "react";
|
|
2
|
-
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext
|
|
3
|
-
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection
|
|
2
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
+
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
4
4
|
import { mergeRegister } from "@lexical/utils";
|
|
5
5
|
import classNames from "classnames";
|
|
6
6
|
import { $isNodeSelection, $getSelection, $getNodeByKey, $setSelection, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, CLICK_COMMAND, DRAGSTART_COMMAND, KEY_DELETE_COMMAND, KEY_BACKSPACE_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND } from "lexical";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createLinkMatcherWithRegExp, AutoLinkPlugin } from "@lexical/react/LexicalAutoLinkPlugin
|
|
1
|
+
import { createLinkMatcherWithRegExp, AutoLinkPlugin } from "@lexical/react/LexicalAutoLinkPlugin";
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
const URL_REGEX = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
4
4
|
const EMAIL_REGEX = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;
|
|
@@ -2,7 +2,7 @@ import React__default from "react";
|
|
|
2
2
|
import { MdastLinkVisitor } from "./MdastLinkVisitor.js";
|
|
3
3
|
import { LexicalLinkVisitor } from "./LexicalLinkVisitor.js";
|
|
4
4
|
import { LinkNode, AutoLinkNode } from "@lexical/link";
|
|
5
|
-
import { LinkPlugin } from "@lexical/react/LexicalLinkPlugin
|
|
5
|
+
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";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { QUOTE, LINK, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST, CODE, BOLD_ITALIC_STAR, BOLD_ITALIC_UNDERSCORE, BOLD_STAR, BOLD_UNDERSCORE, INLINE_CODE, ITALIC_STAR, ITALIC_UNDERSCORE } from "@lexical/markdown";
|
|
2
|
-
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin
|
|
2
|
+
import { MarkdownShortcutPlugin } from "@lexical/react/LexicalMarkdownShortcutPlugin";
|
|
3
3
|
import { HeadingNode, $isHeadingNode, $createHeadingNode } from "@lexical/rich-text";
|
|
4
4
|
import React__default from "react";
|
|
5
5
|
import { realmPlugin } from "../../RealmWithPlugins.js";
|
|
6
6
|
import { CodeBlockNode, $createCodeBlockNode } from "../codeblock/CodeBlockNode.js";
|
|
7
7
|
import { activePlugins$, addComposerChild$, addNestedEditorChild$ } from "../core/index.js";
|
|
8
8
|
import { allowedHeadingLevels$ } from "../headings/index.js";
|
|
9
|
+
import { HorizontalRuleNode, $isHorizontalRuleNode, $createHorizontalRuleNode } from "@lexical/react/LexicalHorizontalRuleNode";
|
|
9
10
|
const markdownShortcutPlugin = realmPlugin({
|
|
10
11
|
init(realm) {
|
|
11
12
|
const pluginIds = realm.getValue(activePlugins$);
|
|
@@ -25,6 +26,18 @@ const createBlockNode = (createNode) => {
|
|
|
25
26
|
node.select(0, 0);
|
|
26
27
|
};
|
|
27
28
|
};
|
|
29
|
+
const THEMATIC_BREAK = {
|
|
30
|
+
dependencies: [HorizontalRuleNode],
|
|
31
|
+
export: (node) => {
|
|
32
|
+
return $isHorizontalRuleNode(node) ? "***" : null;
|
|
33
|
+
},
|
|
34
|
+
regExp: /^(---|\*\*\*|___)?/,
|
|
35
|
+
replace: (parentNode) => {
|
|
36
|
+
const node = $createHorizontalRuleNode();
|
|
37
|
+
parentNode.replace(node);
|
|
38
|
+
},
|
|
39
|
+
type: "element"
|
|
40
|
+
};
|
|
28
41
|
function pickTransformersForActivePlugins(pluginIds, allowedHeadingLevels) {
|
|
29
42
|
const transformers = [
|
|
30
43
|
BOLD_ITALIC_STAR,
|
|
@@ -59,6 +72,9 @@ function pickTransformersForActivePlugins(pluginIds, allowedHeadingLevels) {
|
|
|
59
72
|
};
|
|
60
73
|
transformers.push(HEADING);
|
|
61
74
|
}
|
|
75
|
+
if (pluginIds.includes("thematicBreak")) {
|
|
76
|
+
transformers.push(THEMATIC_BREAK);
|
|
77
|
+
}
|
|
62
78
|
if (pluginIds.includes("quote")) {
|
|
63
79
|
transformers.push(QUOTE);
|
|
64
80
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ContentEditable } from "@lexical/react/LexicalContentEditable
|
|
2
|
-
import LexicalErrorBoundary from "@lexical/react/LexicalErrorBoundary
|
|
3
|
-
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer
|
|
4
|
-
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin
|
|
1
|
+
import { ContentEditable } from "@lexical/react/LexicalContentEditable";
|
|
2
|
+
import { LexicalErrorBoundary } from "@lexical/react/LexicalErrorBoundary";
|
|
3
|
+
import { LexicalNestedComposer } from "@lexical/react/LexicalNestedComposer";
|
|
4
|
+
import { RichTextPlugin } from "@lexical/react/LexicalRichTextPlugin";
|
|
5
5
|
import * as RadixPopover from "@radix-ui/react-popover";
|
|
6
6
|
import { $createParagraphNode, createEditor, $getRoot, KEY_TAB_COMMAND, COMMAND_PRIORITY_CRITICAL, FOCUS_COMMAND, COMMAND_PRIORITY_LOW, KEY_ENTER_COMMAND, BLUR_COMMAND, COMMAND_PRIORITY_EDITOR } from "lexical";
|
|
7
7
|
import React__default from "react";
|
|
8
8
|
import { exportLexicalTreeToMdast } from "../../exportMarkdownFromLexical.js";
|
|
9
9
|
import { importMdastTreeToLexical } from "../../importMarkdownToLexical.js";
|
|
10
10
|
import { lexicalTheme } from "../../styles/lexicalTheme.js";
|
|
11
|
-
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin
|
|
11
|
+
import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
12
12
|
import { mergeRegister } from "@lexical/utils";
|
|
13
13
|
import * as RadixToolbar from "@radix-ui/react-toolbar";
|
|
14
14
|
import classNames from "classnames";
|
|
@@ -2,7 +2,7 @@ import { realmPlugin } from "../../RealmWithPlugins.js";
|
|
|
2
2
|
import { INSERT_HORIZONTAL_RULE_COMMAND, HorizontalRuleNode } from "@lexical/react/LexicalHorizontalRuleNode.js";
|
|
3
3
|
import { HorizontalRulePlugin } from "@lexical/react/LexicalHorizontalRulePlugin.js";
|
|
4
4
|
import { Action, withLatestFrom } from "@mdxeditor/gurx";
|
|
5
|
-
import { activeEditor$, addImportVisitor$, addLexicalNode$, addExportVisitor$, addComposerChild$ } from "../core/index.js";
|
|
5
|
+
import { activeEditor$, addActivePlugin$, addImportVisitor$, addLexicalNode$, addExportVisitor$, addComposerChild$ } from "../core/index.js";
|
|
6
6
|
import { LexicalThematicBreakVisitor } from "./LexicalThematicBreakVisitor.js";
|
|
7
7
|
import { MdastThematicBreakVisitor } from "./MdastThematicBreakVisitor.js";
|
|
8
8
|
const insertThematicBreak$ = Action((r) => {
|
|
@@ -13,6 +13,7 @@ const insertThematicBreak$ = Action((r) => {
|
|
|
13
13
|
const thematicBreakPlugin = realmPlugin({
|
|
14
14
|
init(realm) {
|
|
15
15
|
realm.pubIn({
|
|
16
|
+
[addActivePlugin$]: "thematicBreak",
|
|
16
17
|
[addImportVisitor$]: MdastThematicBreakVisitor,
|
|
17
18
|
[addLexicalNode$]: HorizontalRuleNode,
|
|
18
19
|
[addExportVisitor$]: LexicalThematicBreakVisitor,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"*.css"
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
|
-
"version": "3.
|
|
14
|
+
"version": "3.26.0",
|
|
15
15
|
"description": "React component for rich text markdown editing",
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "vite build",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
"@codemirror/state": "^6.4.0",
|
|
44
44
|
"@codemirror/view": "^6.23.0",
|
|
45
45
|
"@codesandbox/sandpack-react": "^2.19.11",
|
|
46
|
-
"@lexical/clipboard": "^0.
|
|
47
|
-
"@lexical/link": "^0.
|
|
48
|
-
"@lexical/list": "^0.
|
|
49
|
-
"@lexical/markdown": "^0.
|
|
50
|
-
"@lexical/plain-text": "^0.
|
|
51
|
-
"@lexical/react": "^0.
|
|
52
|
-
"@lexical/rich-text": "^0.
|
|
53
|
-
"@lexical/selection": "^0.
|
|
54
|
-
"@lexical/utils": "^0.
|
|
46
|
+
"@lexical/clipboard": "^0.27.1",
|
|
47
|
+
"@lexical/link": "^0.27.1",
|
|
48
|
+
"@lexical/list": "^0.27.1",
|
|
49
|
+
"@lexical/markdown": "^0.27.1",
|
|
50
|
+
"@lexical/plain-text": "^0.27.1",
|
|
51
|
+
"@lexical/react": "^0.27.1",
|
|
52
|
+
"@lexical/rich-text": "^0.27.1",
|
|
53
|
+
"@lexical/selection": "^0.27.1",
|
|
54
|
+
"@lexical/utils": "^0.27.1",
|
|
55
55
|
"@mdxeditor/gurx": "^1.1.4",
|
|
56
56
|
"@radix-ui/colors": "^3.0.0",
|
|
57
57
|
"@radix-ui/react-dialog": "^1.0.5",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"codemirror": "^6.0.1",
|
|
67
67
|
"downshift": "^7.6.0",
|
|
68
68
|
"js-yaml": "4.1.0",
|
|
69
|
-
"lexical": "^0.
|
|
69
|
+
"lexical": "^0.27.1",
|
|
70
70
|
"mdast-util-directive": "^3.0.0",
|
|
71
71
|
"mdast-util-from-markdown": "^2.0.0",
|
|
72
72
|
"mdast-util-frontmatter": "^2.0.1",
|