@mdxeditor/editor 3.21.2 → 3.21.3
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/index.d.ts
CHANGED
|
@@ -1254,7 +1254,7 @@ export declare const headingsPlugin: (params?: {
|
|
|
1254
1254
|
* All the HTML tags supported by the generic html node.
|
|
1255
1255
|
* @group HTML
|
|
1256
1256
|
*/
|
|
1257
|
-
export declare const htmlTags:
|
|
1257
|
+
export declare const htmlTags: string[];
|
|
1258
1258
|
|
|
1259
1259
|
/**
|
|
1260
1260
|
* A callback that returns the icon component for the given name.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { $isLexicalJsxNode } from "./LexicalJsxNode.js";
|
|
2
2
|
import { isMdastJsxNode } from "./index.js";
|
|
3
|
+
import { htmlTags } from "../core/MdastHTMLNode.js";
|
|
3
4
|
const LexicalJsxVisitor = {
|
|
4
5
|
testLexicalNode: $isLexicalJsxNode,
|
|
5
6
|
visitLexicalNode({ actions, mdastParent, lexicalNode }) {
|
|
6
7
|
function traverseNestedJsxNodes(node) {
|
|
7
8
|
if ("children" in node && node.children instanceof Array) {
|
|
8
9
|
node.children.forEach((child) => {
|
|
9
|
-
if (isMdastJsxNode(child)) {
|
|
10
|
+
if (isMdastJsxNode(child) && !htmlTags.includes(child.name.toLowerCase())) {
|
|
10
11
|
actions.registerReferredComponent(child.name);
|
|
11
12
|
}
|
|
12
13
|
traverseNestedJsxNodes(child);
|
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
import { ButtonWithTooltip } from "../primitives/toolbar.js";
|
|
2
2
|
import React__default from "react";
|
|
3
3
|
import { insertTable$ } from "../../table/index.js";
|
|
4
|
-
import { useCellValue, usePublisher } from "@mdxeditor/gurx";
|
|
5
|
-
import { iconComponentFor$, useTranslation } from "../../core/index.js";
|
|
4
|
+
import { Cell, map, useCellValue, usePublisher } from "@mdxeditor/gurx";
|
|
5
|
+
import { activeEditor$, iconComponentFor$, useTranslation } from "../../core/index.js";
|
|
6
|
+
const disableInsertTableButton$ = Cell(false, (r) => {
|
|
7
|
+
r.link(
|
|
8
|
+
r.pipe(
|
|
9
|
+
activeEditor$,
|
|
10
|
+
map((editor) => {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
return ["td", "th"].includes(((_b = (_a = editor == null ? void 0 : editor.getRootElement()) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.nodeName.toLowerCase()) ?? "");
|
|
13
|
+
})
|
|
14
|
+
),
|
|
15
|
+
disableInsertTableButton$
|
|
16
|
+
);
|
|
17
|
+
});
|
|
6
18
|
const InsertTable = () => {
|
|
7
19
|
const iconComponentFor = useCellValue(iconComponentFor$);
|
|
8
20
|
const insertTable = usePublisher(insertTable$);
|
|
9
21
|
const t = useTranslation();
|
|
22
|
+
const isDisabled = useCellValue(disableInsertTableButton$);
|
|
10
23
|
return /* @__PURE__ */ React__default.createElement(
|
|
11
24
|
ButtonWithTooltip,
|
|
12
25
|
{
|
|
13
26
|
title: t("toolbar.table", "Insert Table"),
|
|
14
27
|
onClick: () => {
|
|
15
28
|
insertTable({ rows: 3, columns: 3 });
|
|
16
|
-
}
|
|
29
|
+
},
|
|
30
|
+
...isDisabled ? { "aria-disabled": true, "data-disabled": true, disabled: true } : {}
|
|
17
31
|
},
|
|
18
32
|
iconComponentFor("table")
|
|
19
33
|
);
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"*.css"
|
|
12
12
|
],
|
|
13
13
|
"type": "module",
|
|
14
|
-
"version": "3.21.
|
|
14
|
+
"version": "3.21.3",
|
|
15
15
|
"description": "React component for rich text markdown editing",
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "vite build",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@codemirror/merge": "^6.4.0",
|
|
43
43
|
"@codemirror/state": "^6.4.0",
|
|
44
44
|
"@codemirror/view": "^6.23.0",
|
|
45
|
-
"@codesandbox/sandpack-react": "^2.
|
|
45
|
+
"@codesandbox/sandpack-react": "^2.19.11",
|
|
46
46
|
"@lexical/clipboard": "^0.23.1",
|
|
47
47
|
"@lexical/link": "^0.23.1",
|
|
48
48
|
"@lexical/list": "^0.23.1",
|