@lobehub/editor 1.11.0 → 1.13.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/es/editor-kernel/inode/helper.d.ts +9 -6
- package/es/editor-kernel/inode/helper.js +27 -0
- package/es/editor-kernel/inode/text-node.d.ts +2 -9
- package/es/plugins/code/plugin/index.d.ts +1 -1
- package/es/plugins/code/plugin/index.js +12 -1
- package/es/plugins/codeblock/command/index.d.ts +6 -0
- package/es/plugins/codeblock/command/index.js +1 -0
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.d.ts +7 -0
- package/es/plugins/codeblock/plugin/CodeHighlighterShiki.js +43 -2
- package/es/plugins/codeblock/plugin/FacadeShiki.d.ts +8 -1
- package/es/plugins/codeblock/plugin/FacadeShiki.js +95 -6
- package/es/plugins/codeblock/plugin/index.js +74 -29
- package/es/plugins/common/data-source/json-data-source.d.ts +2 -2
- package/es/plugins/common/data-source/json-data-source.js +2 -10
- package/es/plugins/common/index.d.ts +1 -1
- package/es/plugins/common/index.js +1 -1
- package/es/plugins/common/node/cursor.d.ts +3 -1
- package/es/plugins/common/node/cursor.js +9 -0
- package/es/plugins/common/plugin/index.d.ts +1 -1
- package/es/plugins/common/plugin/index.js +28 -1
- package/es/plugins/common/plugin/mdReader.d.ts +2 -0
- package/es/plugins/common/plugin/mdReader.js +84 -0
- package/es/plugins/common/react/ReactPlainText.d.ts +1 -1
- package/es/plugins/common/utils/index.d.ts +2 -2
- package/es/plugins/hr/plugin/index.js +26 -22
- package/es/plugins/link/plugin/index.js +42 -26
- package/es/plugins/list/plugin/index.js +121 -63
- package/es/plugins/list/utils/index.d.ts +3 -3
- package/es/plugins/markdown/data-source/markdown/parse.d.ts +21 -0
- package/es/plugins/markdown/data-source/markdown/parse.js +231 -0
- package/es/plugins/markdown/data-source/markdown/supersub.d.ts +1 -0
- package/es/plugins/markdown/data-source/markdown/supersub.js +14 -0
- package/es/plugins/markdown/data-source/markdown-data-source.d.ts +4 -4
- package/es/plugins/markdown/data-source/markdown-data-source.js +8 -2
- package/es/plugins/markdown/index.d.ts +2 -1
- package/es/plugins/markdown/index.js +1 -1
- package/es/plugins/markdown/plugin/index.js +135 -2
- package/es/plugins/markdown/service/shortcut.d.ts +19 -85
- package/es/plugins/markdown/service/shortcut.js +49 -293
- package/es/plugins/markdown/service/transformers.d.ts +60 -0
- package/es/plugins/markdown/service/transformers.js +286 -0
- package/es/plugins/markdown/utils/index.d.ts +45 -1
- package/es/plugins/markdown/utils/index.js +147 -1
- package/es/plugins/markdown/utils/logger.d.ts +7 -0
- package/es/plugins/markdown/utils/logger.js +2 -0
- package/es/plugins/math/plugin/index.js +64 -45
- package/es/plugins/mention/index.d.ts +1 -0
- package/es/plugins/mention/plugin/index.d.ts +4 -1
- package/es/plugins/mention/plugin/index.js +27 -11
- package/es/plugins/table/plugin/index.js +71 -26
- package/es/react/hooks/useEditorState/index.js +43 -21
- package/es/types/global.d.ts +64 -0
- package/package.json +2 -1
|
@@ -14,7 +14,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
14
14
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
15
15
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
16
|
import { KernelPlugin } from "../../../editor-kernel/plugin";
|
|
17
|
-
import { IMarkdownShortCutService } from "../../markdown";
|
|
17
|
+
import { IMarkdownShortCutService, MARKDOWN_READER_LEVEL_HIGH } from "../../markdown";
|
|
18
18
|
import { registerMentionCommand } from "../command";
|
|
19
19
|
import { $isMentionNode, MentionNode } from "../node/MentionNode";
|
|
20
20
|
import { registerMentionNodeSelectionObserver } from "./register";
|
|
@@ -25,7 +25,6 @@ export var MentionPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
25
25
|
_inherits(MentionPlugin, _KernelPlugin);
|
|
26
26
|
var _super = _createSuper(MentionPlugin);
|
|
27
27
|
function MentionPlugin(kernel, config) {
|
|
28
|
-
var _kernel$requireServic;
|
|
29
28
|
var _this;
|
|
30
29
|
_classCallCheck(this, MentionPlugin);
|
|
31
30
|
_this = _super.call(this);
|
|
@@ -39,15 +38,6 @@ export var MentionPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
39
38
|
_this.registerDecorator(kernel, MentionNode.getType(), function (node, editor) {
|
|
40
39
|
return config !== null && config !== void 0 && config.decorator ? config.decorator(node, editor) : null;
|
|
41
40
|
});
|
|
42
|
-
(_kernel$requireServic = kernel.requireService(IMarkdownShortCutService)) === null || _kernel$requireServic === void 0 || _kernel$requireServic.registerMarkdownWriter(MentionNode.getType(), function (ctx, node) {
|
|
43
|
-
if ($isMentionNode(node)) {
|
|
44
|
-
if (config !== null && config !== void 0 && config.markdownWriter) {
|
|
45
|
-
ctx.appendLine(config.markdownWriter(node));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
ctx.appendLine("".concat(node.label));
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
41
|
return _this;
|
|
52
42
|
}
|
|
53
43
|
_createClass(MentionPlugin, [{
|
|
@@ -55,6 +45,32 @@ export var MentionPlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
55
45
|
value: function onInit(editor) {
|
|
56
46
|
this.register(registerMentionCommand(editor));
|
|
57
47
|
this.register(registerMentionNodeSelectionObserver(editor));
|
|
48
|
+
this.registerMarkdown();
|
|
49
|
+
}
|
|
50
|
+
}, {
|
|
51
|
+
key: "registerMarkdown",
|
|
52
|
+
value: function registerMarkdown() {
|
|
53
|
+
var _this$kernel$requireS,
|
|
54
|
+
_this2 = this,
|
|
55
|
+
_this$config;
|
|
56
|
+
(_this$kernel$requireS = this.kernel.requireService(IMarkdownShortCutService)) === null || _this$kernel$requireS === void 0 || _this$kernel$requireS.registerMarkdownWriter(MentionNode.getType(), function (ctx, node) {
|
|
57
|
+
if ($isMentionNode(node)) {
|
|
58
|
+
var _this2$config;
|
|
59
|
+
if ((_this2$config = _this2.config) !== null && _this2$config !== void 0 && _this2$config.markdownWriter) {
|
|
60
|
+
ctx.appendLine(_this2.config.markdownWriter(node));
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
ctx.appendLine("".concat(node.label));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
if ((_this$config = this.config) !== null && _this$config !== void 0 && _this$config.markdownReader) {
|
|
67
|
+
var _this$kernel$requireS2;
|
|
68
|
+
(_this$kernel$requireS2 = this.kernel.requireService(IMarkdownShortCutService)) === null || _this$kernel$requireS2 === void 0 || _this$kernel$requireS2.registerMarkdownReader('html', function (node, children) {
|
|
69
|
+
var _this2$config2;
|
|
70
|
+
return (_this2$config2 = _this2.config) !== null && _this2$config2 !== void 0 && _this2$config2.markdownReader ? _this2.config.markdownReader(node, children) || false : false;
|
|
71
|
+
// return this.config?.markdownReader ? this.config.markdownReader(node, children) || false : false;
|
|
72
|
+
}, MARKDOWN_READER_LEVEL_HIGH);
|
|
73
|
+
}
|
|
58
74
|
}
|
|
59
75
|
}]);
|
|
60
76
|
return MentionPlugin;
|
|
@@ -15,6 +15,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
15
15
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
16
|
import { $isTableNode, TableCellNode, TableRowNode, registerTableCellUnmergeTransform, registerTablePlugin, registerTableSelectionObserver, setScrollableTablesActive } from '@lexical/table';
|
|
17
17
|
import { cx } from 'antd-style';
|
|
18
|
+
import { INodeHelper } from "../../../editor-kernel/inode/helper";
|
|
18
19
|
import { KernelPlugin } from "../../../editor-kernel/plugin";
|
|
19
20
|
import { IMarkdownShortCutService } from "../../markdown";
|
|
20
21
|
import { registerTableCommand } from "../command";
|
|
@@ -29,7 +30,6 @@ export var TablePlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
29
30
|
_inherits(TablePlugin, _KernelPlugin);
|
|
30
31
|
var _super = _createSuper(TablePlugin);
|
|
31
32
|
function TablePlugin(kernel, options) {
|
|
32
|
-
var _kernel$requireServic, _kernel$requireServic2, _kernel$requireServic3;
|
|
33
33
|
var _this;
|
|
34
34
|
_classCallCheck(this, TablePlugin);
|
|
35
35
|
_this = _super.call(this);
|
|
@@ -44,31 +44,6 @@ export var TablePlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
44
44
|
tableCellSelected: 'editor_table_cell_selected',
|
|
45
45
|
tableScrollableWrapper: cx('editor_table_scrollable_wrapper', options === null || options === void 0 ? void 0 : options.theme)
|
|
46
46
|
});
|
|
47
|
-
(_kernel$requireServic = kernel.requireService(IMarkdownShortCutService)) === null || _kernel$requireServic === void 0 || _kernel$requireServic.registerMarkdownWriter(TableNode.getType(), function (ctx) {
|
|
48
|
-
ctx.wrap('', '\n');
|
|
49
|
-
});
|
|
50
|
-
(_kernel$requireServic2 = kernel.requireService(IMarkdownShortCutService)) === null || _kernel$requireServic2 === void 0 || _kernel$requireServic2.registerMarkdownWriter(TableRowNode.getType(), function (ctx, node) {
|
|
51
|
-
var parent = node.getParent();
|
|
52
|
-
if (!$isTableNode(parent)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (!node.getPreviousSibling()) {
|
|
56
|
-
var _parent$getColWidths;
|
|
57
|
-
ctx.wrap('', "\n".concat((_parent$getColWidths = parent.getColWidths()) === null || _parent$getColWidths === void 0 ? void 0 : _parent$getColWidths.map(function () {
|
|
58
|
-
return '|:--';
|
|
59
|
-
}).join(''), "|\n"));
|
|
60
|
-
} else {
|
|
61
|
-
ctx.wrap('', '\n');
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
(_kernel$requireServic3 = kernel.requireService(IMarkdownShortCutService)) === null || _kernel$requireServic3 === void 0 || _kernel$requireServic3.registerMarkdownWriter(TableCellNode.getType(), function (ctx, node) {
|
|
65
|
-
ctx.addProcessor(tableCellProcessor);
|
|
66
|
-
if (!node.getNextSibling()) {
|
|
67
|
-
ctx.wrap('|', '|');
|
|
68
|
-
} else {
|
|
69
|
-
ctx.wrap('|', '');
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
47
|
return _this;
|
|
73
48
|
}
|
|
74
49
|
_createClass(TablePlugin, [{
|
|
@@ -79,6 +54,76 @@ export var TablePlugin = (_class = /*#__PURE__*/function (_KernelPlugin) {
|
|
|
79
54
|
this.register(registerTableSelectionObserver(editor));
|
|
80
55
|
this.register(registerTableCellUnmergeTransform(editor));
|
|
81
56
|
this.register(registerTableCommand(editor));
|
|
57
|
+
this.registerMarkdown();
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
key: "registerMarkdown",
|
|
61
|
+
value: function registerMarkdown() {
|
|
62
|
+
var markdownService = this.kernel.requireService(IMarkdownShortCutService);
|
|
63
|
+
if (!markdownService) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
markdownService.registerMarkdownWriter(TableNode.getType(), function (ctx) {
|
|
67
|
+
ctx.wrap('', '\n');
|
|
68
|
+
});
|
|
69
|
+
markdownService.registerMarkdownWriter(TableRowNode.getType(), function (ctx, node) {
|
|
70
|
+
var parent = node.getParent();
|
|
71
|
+
if (!$isTableNode(parent)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (!node.getPreviousSibling()) {
|
|
75
|
+
var _parent$getColWidths;
|
|
76
|
+
ctx.wrap('', "\n".concat((_parent$getColWidths = parent.getColWidths()) === null || _parent$getColWidths === void 0 ? void 0 : _parent$getColWidths.map(function () {
|
|
77
|
+
return '|:--';
|
|
78
|
+
}).join(''), "|\n"));
|
|
79
|
+
} else {
|
|
80
|
+
ctx.wrap('', '\n');
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
markdownService.registerMarkdownWriter(TableCellNode.getType(), function (ctx, node) {
|
|
84
|
+
ctx.addProcessor(tableCellProcessor);
|
|
85
|
+
if (!node.getNextSibling()) {
|
|
86
|
+
ctx.wrap('|', '|');
|
|
87
|
+
} else {
|
|
88
|
+
ctx.wrap('|', '');
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
markdownService.registerMarkdownReader('table', function (node, children) {
|
|
92
|
+
var _node$children$;
|
|
93
|
+
var colLen = ((_node$children$ = node.children[0]) === null || _node$children$ === void 0 ? void 0 : _node$children$.children.length) || 1;
|
|
94
|
+
return INodeHelper.createElementNode('table', {
|
|
95
|
+
children: children,
|
|
96
|
+
// eslint-disable-next-line unicorn/no-new-array
|
|
97
|
+
colWidths: new Array(colLen).fill(750 / colLen),
|
|
98
|
+
direction: null,
|
|
99
|
+
format: '',
|
|
100
|
+
indent: 0,
|
|
101
|
+
version: 1
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
markdownService.registerMarkdownReader('tableRow', function (_node, children) {
|
|
105
|
+
return INodeHelper.createElementNode('tablerow', {
|
|
106
|
+
children: children,
|
|
107
|
+
direction: 'ltr',
|
|
108
|
+
format: '',
|
|
109
|
+
height: 33,
|
|
110
|
+
indent: 0,
|
|
111
|
+
version: 1
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
markdownService.registerMarkdownReader('tableCell', function (_node, children) {
|
|
115
|
+
return INodeHelper.createElementNode('tablecell', {
|
|
116
|
+
backgroundColor: null,
|
|
117
|
+
children: children,
|
|
118
|
+
colSpan: 1,
|
|
119
|
+
direction: 'ltr',
|
|
120
|
+
format: '',
|
|
121
|
+
headerState: 0,
|
|
122
|
+
indent: 0,
|
|
123
|
+
rowSpan: 1,
|
|
124
|
+
version: 1
|
|
125
|
+
});
|
|
126
|
+
});
|
|
82
127
|
}
|
|
83
128
|
}]);
|
|
84
129
|
return TablePlugin;
|
|
@@ -57,36 +57,44 @@ export function useEditorState(editor) {
|
|
|
57
57
|
setIsStrikethrough = _useState12[1];
|
|
58
58
|
var _useState13 = useState(false),
|
|
59
59
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
isSubscript = _useState14[0],
|
|
61
|
+
setIsSubscript = _useState14[1];
|
|
62
62
|
var _useState15 = useState(false),
|
|
63
63
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
isSuperscript = _useState16[0],
|
|
65
|
+
setIsSuperscript = _useState16[1];
|
|
66
66
|
var _useState17 = useState(false),
|
|
67
67
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
isCode = _useState18[0],
|
|
69
|
+
setIsCode = _useState18[1];
|
|
70
70
|
var _useState19 = useState(false),
|
|
71
71
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var _useState21 = useState(
|
|
72
|
+
isLink = _useState20[0],
|
|
73
|
+
setIsLink = _useState20[1];
|
|
74
|
+
var _useState21 = useState(false),
|
|
75
75
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
var _useState23 = useState(
|
|
76
|
+
isCodeblock = _useState22[0],
|
|
77
|
+
setIsInCodeblok = _useState22[1];
|
|
78
|
+
var _useState23 = useState(false),
|
|
79
79
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
var _useState25 = useState(
|
|
80
|
+
isBlockquote = _useState24[0],
|
|
81
|
+
setIsInBlockquote = _useState24[1];
|
|
82
|
+
var _useState25 = useState(null),
|
|
83
83
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
var _useState27 = useState(
|
|
84
|
+
codeblockLang = _useState26[0],
|
|
85
|
+
setCodeblockLang = _useState26[1];
|
|
86
|
+
var _useState27 = useState(true),
|
|
87
87
|
_useState28 = _slicedToArray(_useState27, 2),
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
isEmpty = _useState28[0],
|
|
89
|
+
setIsEmpty = _useState28[1];
|
|
90
|
+
var _useState29 = useState(false),
|
|
91
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
|
92
|
+
isSelected = _useState30[0],
|
|
93
|
+
setIsSelected = _useState30[1];
|
|
94
|
+
var _useState31 = useState(null),
|
|
95
|
+
_useState32 = _slicedToArray(_useState31, 2),
|
|
96
|
+
blockType = _useState32[0],
|
|
97
|
+
setBlockType = _useState32[1];
|
|
90
98
|
var $handleHeadingNode = useCallback(function (selectedElement) {
|
|
91
99
|
var type = $isHeadingNode(selectedElement) ? selectedElement.getTag() : selectedElement.getType();
|
|
92
100
|
setBlockType(type);
|
|
@@ -105,6 +113,8 @@ export function useEditorState(editor) {
|
|
|
105
113
|
setIsItalic(selection.hasFormat('italic'));
|
|
106
114
|
setIsUnderline(selection.hasFormat('underline'));
|
|
107
115
|
setIsStrikethrough(selection.hasFormat('strikethrough'));
|
|
116
|
+
setIsSubscript(selection.hasFormat('subscript'));
|
|
117
|
+
setIsSuperscript(selection.hasFormat('superscript'));
|
|
108
118
|
setIsCode($isSelectionInCodeInline(lexicalEditor));
|
|
109
119
|
var anchorNode = selection.anchor.getNode();
|
|
110
120
|
var focusNode = selection.focus.getNode();
|
|
@@ -135,6 +145,8 @@ export function useEditorState(editor) {
|
|
|
135
145
|
setIsItalic(false);
|
|
136
146
|
setIsUnderline(false);
|
|
137
147
|
setIsStrikethrough(false);
|
|
148
|
+
setIsSubscript(false);
|
|
149
|
+
setIsSuperscript(false);
|
|
138
150
|
setIsCode(false);
|
|
139
151
|
setIsLink(false);
|
|
140
152
|
setIsInCodeblok(false);
|
|
@@ -164,6 +176,12 @@ export function useEditorState(editor) {
|
|
|
164
176
|
var italic = useCallback(function () {
|
|
165
177
|
formatText('italic');
|
|
166
178
|
}, [formatText]);
|
|
179
|
+
var subscript = useCallback(function () {
|
|
180
|
+
formatText('subscript');
|
|
181
|
+
}, [formatText]);
|
|
182
|
+
var superscript = useCallback(function () {
|
|
183
|
+
formatText('superscript');
|
|
184
|
+
}, [formatText]);
|
|
167
185
|
var code = useCallback(function () {
|
|
168
186
|
editor === null || editor === void 0 || editor.dispatchCommand(INSERT_CODEINLINE_COMMAND, undefined);
|
|
169
187
|
}, [formatText]);
|
|
@@ -360,14 +378,18 @@ export function useEditorState(editor) {
|
|
|
360
378
|
isItalic: isItalic,
|
|
361
379
|
isSelected: isSelected,
|
|
362
380
|
isStrikethrough: isStrikethrough,
|
|
381
|
+
isSubscript: isSubscript,
|
|
382
|
+
isSuperscript: isSuperscript,
|
|
363
383
|
isUnderline: isUnderline,
|
|
364
384
|
italic: italic,
|
|
365
385
|
numberList: numberList,
|
|
366
386
|
redo: redo,
|
|
367
387
|
strikethrough: strikethrough,
|
|
388
|
+
subscript: subscript,
|
|
389
|
+
superscript: superscript,
|
|
368
390
|
underline: underline,
|
|
369
391
|
undo: undo,
|
|
370
392
|
updateCodeblockLang: updateCodeblockLang
|
|
371
393
|
};
|
|
372
|
-
}, [blockType, canRedo, canUndo, codeblockLang, isBold, isCode, isEmpty, isBlockquote, isCodeblock, isItalic, isSelected, isStrikethrough, isUnderline, italic]);
|
|
394
|
+
}, [blockType, canRedo, canUndo, codeblockLang, isBold, isCode, isEmpty, isBlockquote, isCodeblock, isItalic, isSelected, isStrikethrough, isUnderline, isSubscript, isSuperscript, italic]);
|
|
373
395
|
}
|
package/es/types/global.d.ts
CHANGED
|
@@ -1,6 +1,52 @@
|
|
|
1
1
|
import type { LobeCustomStylish, LobeCustomToken } from '@lobehub/ui';
|
|
2
2
|
import 'antd-style';
|
|
3
3
|
import 'lexical/LexicalEditor';
|
|
4
|
+
import type { Data, Literal } from 'mdast';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Info associated with mdast superscript (flow) nodes by the ecosystem.
|
|
8
|
+
*/
|
|
9
|
+
export type SuperscriptData = Data;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Superscript (flow).
|
|
13
|
+
*/
|
|
14
|
+
export interface Superscript extends Literal {
|
|
15
|
+
/**
|
|
16
|
+
* Data associated with the mdast superscript (flow).
|
|
17
|
+
*/
|
|
18
|
+
data?: SuperscriptData | undefined;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Custom information relating to the node.
|
|
22
|
+
*/
|
|
23
|
+
meta?: string | null | undefined;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Node type of superscript (flow).
|
|
27
|
+
*/
|
|
28
|
+
type: 'superscript';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Subscript (flow).
|
|
33
|
+
*/
|
|
34
|
+
export interface Subscript extends Literal {
|
|
35
|
+
/**
|
|
36
|
+
* Data associated with the mdast superscript (flow).
|
|
37
|
+
*/
|
|
38
|
+
data?: SuperscriptData | undefined;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Custom information relating to the node.
|
|
42
|
+
*/
|
|
43
|
+
meta?: string | null | undefined;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Node type of subscript (flow).
|
|
47
|
+
*/
|
|
48
|
+
type: 'subscript';
|
|
49
|
+
}
|
|
4
50
|
|
|
5
51
|
declare module 'antd-style' {
|
|
6
52
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
@@ -22,3 +68,21 @@ declare module '*.svg' {
|
|
|
22
68
|
declare namespace globalThis {
|
|
23
69
|
let __DEV__: boolean | undefined;
|
|
24
70
|
}
|
|
71
|
+
|
|
72
|
+
// Add nodes to tree.
|
|
73
|
+
declare module 'mdast' {
|
|
74
|
+
interface BlockContentMap {
|
|
75
|
+
subscript: Subscript;
|
|
76
|
+
superscript: Superscript;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface PhrasingContentMap {
|
|
80
|
+
subscript: Subscript;
|
|
81
|
+
superscript: Superscript;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
interface RootContentMap {
|
|
85
|
+
subscript: Subscript;
|
|
86
|
+
superscript: Superscript;
|
|
87
|
+
}
|
|
88
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/editor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "A powerful and extensible rich text editor built on Meta's Lexical framework, providing a modern editing experience with React integration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"react-error-boundary": "^6.0.0",
|
|
57
57
|
"react-layout-kit": "^2.0.0",
|
|
58
58
|
"react-merge-refs": "^3.0.2",
|
|
59
|
+
"remark-supersub": "^1.0.0",
|
|
59
60
|
"shiki": "^3.9.2",
|
|
60
61
|
"ts-key-enum": "^3.0.13",
|
|
61
62
|
"use-merge-value": "^1.2.0"
|