@ctzhian/tiptap 1.12.21 → 1.12.24
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/Editor/demo.js +1 -1
- package/dist/component/CustomBubbleMenu/index.js +8 -27
- package/dist/component/CustomDragHandle/index.js +44 -72
- package/dist/component/Icons/emotion-line-icon.d.ts +6 -0
- package/dist/component/Icons/emotion-line-icon.js +13 -0
- package/dist/component/Icons/index.d.ts +1 -0
- package/dist/component/Icons/index.js +1 -0
- package/dist/component/Menu/NestedList.d.ts +1 -1
- package/dist/component/Menu/index.js +4 -1
- package/dist/component/Toolbar/EditorInsert/index.js +90 -80
- package/dist/contants/slash-commands.js +65 -53
- package/dist/extension/component/Attachment/AttachmentContent.js +5 -9
- package/dist/extension/component/EmojiList/index.d.ts +3 -0
- package/dist/extension/component/EmojiList/index.js +380 -32
- package/dist/extension/component/UploadProgress/index.d.ts +1 -1
- package/dist/extension/suggestion/emoji.js +165 -16
- package/dist/type/index.d.ts +2 -1
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.js +10 -0
- package/package.json +1 -1
package/dist/Editor/demo.js
CHANGED
|
@@ -152,7 +152,7 @@ var Reader = function Reader() {
|
|
|
152
152
|
}
|
|
153
153
|
return onUpload;
|
|
154
154
|
}(),
|
|
155
|
-
content:
|
|
155
|
+
content: ':'
|
|
156
156
|
}),
|
|
157
157
|
editor = _useTiptap.editor;
|
|
158
158
|
return /*#__PURE__*/React.createElement(EditorThemeProvider, {
|
|
@@ -97,10 +97,7 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
97
97
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
98
98
|
direction: 'row',
|
|
99
99
|
alignItems: 'center'
|
|
100
|
-
}, /*#__PURE__*/React.createElement(ToolbarItem
|
|
101
|
-
// tip='加粗'
|
|
102
|
-
// shortcutKey={['ctrl', 'B']}
|
|
103
|
-
, {
|
|
100
|
+
}, /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
104
101
|
icon: /*#__PURE__*/React.createElement(BoldIcon, {
|
|
105
102
|
sx: {
|
|
106
103
|
fontSize: '1rem'
|
|
@@ -110,10 +107,7 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
110
107
|
return editor.chain().focus().toggleBold().run();
|
|
111
108
|
},
|
|
112
109
|
className: isBold ? "tool-active" : ""
|
|
113
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem
|
|
114
|
-
// tip='斜体'
|
|
115
|
-
// shortcutKey={['ctrl', 'I']}
|
|
116
|
-
, {
|
|
110
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
117
111
|
icon: /*#__PURE__*/React.createElement(ItalicIcon, {
|
|
118
112
|
sx: {
|
|
119
113
|
fontSize: '1rem'
|
|
@@ -123,10 +117,7 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
123
117
|
return editor.chain().focus().toggleItalic().run();
|
|
124
118
|
},
|
|
125
119
|
className: isItalic ? "tool-active" : ""
|
|
126
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem
|
|
127
|
-
// tip='删除线'
|
|
128
|
-
// shortcutKey={['ctrl', 'shift', 'S']}
|
|
129
|
-
, {
|
|
120
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
130
121
|
icon: /*#__PURE__*/React.createElement(StrikethroughIcon, {
|
|
131
122
|
sx: {
|
|
132
123
|
fontSize: '1rem'
|
|
@@ -136,10 +127,7 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
136
127
|
return editor.chain().focus().toggleStrike().run();
|
|
137
128
|
},
|
|
138
129
|
className: isStrike ? "tool-active" : ""
|
|
139
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem
|
|
140
|
-
// tip='下划线'
|
|
141
|
-
// shortcutKey={['ctrl', 'U']}
|
|
142
|
-
, {
|
|
130
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
143
131
|
icon: /*#__PURE__*/React.createElement(UnderlineIcon, {
|
|
144
132
|
sx: {
|
|
145
133
|
fontSize: '1rem'
|
|
@@ -149,10 +137,7 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
149
137
|
return editor.chain().focus().toggleUnderline().run();
|
|
150
138
|
},
|
|
151
139
|
className: isUnderline ? "tool-active" : ""
|
|
152
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem
|
|
153
|
-
// tip='高亮'
|
|
154
|
-
// shortcutKey={['ctrl', 'shift', 'H']}
|
|
155
|
-
, {
|
|
140
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
156
141
|
icon: /*#__PURE__*/React.createElement(MarkPenLineIcon, {
|
|
157
142
|
sx: {
|
|
158
143
|
fontSize: '1rem'
|
|
@@ -162,10 +147,7 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
162
147
|
return editor.chain().focus().toggleHighlight().run();
|
|
163
148
|
},
|
|
164
149
|
className: isHighlight ? "tool-active" : ""
|
|
165
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem
|
|
166
|
-
// tip='行内代码'
|
|
167
|
-
// shortcutKey={['ctrl', 'E']}
|
|
168
|
-
, {
|
|
150
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
169
151
|
icon: /*#__PURE__*/React.createElement(CodeLineIcon, {
|
|
170
152
|
sx: {
|
|
171
153
|
fontSize: '1rem'
|
|
@@ -183,14 +165,13 @@ var CustomBubbleMenu = function CustomBubbleMenu(_ref) {
|
|
|
183
165
|
height: 20,
|
|
184
166
|
alignSelf: 'center'
|
|
185
167
|
}
|
|
186
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem
|
|
187
|
-
// tip='文本格式化'
|
|
188
|
-
, {
|
|
168
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
189
169
|
icon: /*#__PURE__*/React.createElement(EraserLineIcon, {
|
|
190
170
|
sx: {
|
|
191
171
|
fontSize: '1rem'
|
|
192
172
|
}
|
|
193
173
|
}),
|
|
174
|
+
text: "\u6E05\u9664\u683C\u5F0F",
|
|
194
175
|
onClick: function onClick() {
|
|
195
176
|
return editor.chain().focus().unsetAllMarks().run();
|
|
196
177
|
},
|
|
@@ -17,15 +17,14 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
17
17
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
18
18
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
|
-
import { AddLineIcon, AlignBottomIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowDownSLineIcon, AttachmentLineIcon, BrushLineIcon, DeleteLineIcon, DownloadLineIcon, DraggableIcon, EraserLineIcon, FileCopyLineIcon, FontSizeIcon, H1Icon, H2Icon, H3Icon, ImageLineIcon, IndentDecreaseIcon, IndentIncreaseIcon, Information2LineIcon, ListCheck3Icon, ListOrdered2Icon, ListUnorderedIcon, MovieLineIcon, Music2LineIcon, QuoteTextIcon, Repeat2LineIcon, ScissorsCutLineIcon,
|
|
20
|
+
import { AddLineIcon, AlignBottomIcon, AlignCenterIcon, AlignJustifyIcon, AlignLeftIcon, AlignRightIcon, AlignTopIcon, ArrowDownSLineIcon, AttachmentLineIcon, BrushLineIcon, DeleteLineIcon, DownloadLineIcon, DraggableIcon, EraserLineIcon, FileCopyLineIcon, FontSizeIcon, H1Icon, H2Icon, H3Icon, ImageLineIcon, IndentDecreaseIcon, IndentIncreaseIcon, Information2LineIcon, ListCheck3Icon, ListOrdered2Icon, ListUnorderedIcon, MovieLineIcon, Music2LineIcon, QuoteTextIcon, Repeat2LineIcon, ScissorsCutLineIcon, TextIcon, TextWrapIcon } from "../Icons";
|
|
21
21
|
import { NODE_TYPE_LABEL, NodeTypeEnum } from "../../contants/enums";
|
|
22
22
|
import { Box, Divider, Stack, Typography, useTheme } from '@mui/material';
|
|
23
23
|
import DragHandle from '@tiptap/extension-drag-handle-react';
|
|
24
24
|
import { Fragment, Slice } from '@tiptap/pm/model';
|
|
25
25
|
import { NodeSelection } from '@tiptap/pm/state';
|
|
26
|
-
import { useEditorState } from '@tiptap/react';
|
|
27
26
|
import React, { useCallback, useState } from 'react';
|
|
28
|
-
import { convertNodeAt, downloadFiles, filterResourcesByType, getAllResources, getShortcutKeyText,
|
|
27
|
+
import { convertNodeAt, downloadFiles, filterResourcesByType, getAllResources, getShortcutKeyText, hasMarksInBlock } from "../../util";
|
|
29
28
|
import Menu from "../Menu";
|
|
30
29
|
import { ToolbarItem } from "../Toolbar";
|
|
31
30
|
var DragIcon = function DragIcon(_ref) {
|
|
@@ -93,7 +92,7 @@ var AddIcon = function AddIcon(_ref2) {
|
|
|
93
92
|
}));
|
|
94
93
|
};
|
|
95
94
|
var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
96
|
-
var _current$
|
|
95
|
+
var _current$node4, _current$node5, _current$node6, _current$node7, _current$node8, _current$node9, _current$node10, _current$node11, _current$node12, _current$node13, _current$node14, _current$node15, _current$node16, _current$node17;
|
|
97
96
|
var editor = _ref3.editor,
|
|
98
97
|
more = _ref3.more,
|
|
99
98
|
onTip = _ref3.onTip;
|
|
@@ -119,6 +118,10 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
119
118
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
120
119
|
currentNode = _useState6[0],
|
|
121
120
|
setCurrentNode = _useState6[1];
|
|
121
|
+
var _useState7 = useState(false),
|
|
122
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
123
|
+
hasMarks = _useState8[0],
|
|
124
|
+
setHasMarks = _useState8[1];
|
|
122
125
|
var THEME_TEXT_COLOR = [{
|
|
123
126
|
label: '默认色',
|
|
124
127
|
value: theme.palette.text.primary
|
|
@@ -218,16 +221,6 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
218
221
|
view.focus();
|
|
219
222
|
}
|
|
220
223
|
};
|
|
221
|
-
var hasMarksDeep = function hasMarksDeep(node) {
|
|
222
|
-
var _content;
|
|
223
|
-
if (!node) return false;
|
|
224
|
-
if (node.marks && node.marks.length > 0) return true;
|
|
225
|
-
var children = (_content = node.content) === null || _content === void 0 ? void 0 : _content.content;
|
|
226
|
-
if (!children || children.length === 0) return false;
|
|
227
|
-
return children.some(function (child) {
|
|
228
|
-
return hasMarksDeep(child);
|
|
229
|
-
});
|
|
230
|
-
};
|
|
231
224
|
var canCurrentNodeIndent = function canCurrentNodeIndent() {
|
|
232
225
|
return !!(current.node && current.node.type);
|
|
233
226
|
};
|
|
@@ -254,17 +247,11 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
254
247
|
images: images,
|
|
255
248
|
attachments: attachments
|
|
256
249
|
});
|
|
250
|
+
if (data.node) {
|
|
251
|
+
setHasMarks(hasMarksInBlock(data.node));
|
|
252
|
+
}
|
|
257
253
|
}
|
|
258
254
|
}, [current.pos, current.node]);
|
|
259
|
-
var _useEditorState = useEditorState({
|
|
260
|
-
editor: editor,
|
|
261
|
-
selector: function selector(ctx) {
|
|
262
|
-
return {
|
|
263
|
-
hasMarks: hasMarksInSelection(ctx.editor.state)
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
}),
|
|
267
|
-
hasMarks = _useEditorState.hasMarks;
|
|
268
255
|
return /*#__PURE__*/React.createElement(DragHandle, {
|
|
269
256
|
editor: editor,
|
|
270
257
|
onNodeChange: updateNodeChange
|
|
@@ -353,7 +340,14 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
353
340
|
transform: 'rotate(-90deg)'
|
|
354
341
|
}
|
|
355
342
|
}),
|
|
356
|
-
header: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(
|
|
343
|
+
header: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, {
|
|
344
|
+
sx: {
|
|
345
|
+
p: 1,
|
|
346
|
+
fontSize: '0.75rem',
|
|
347
|
+
color: 'text.secondary',
|
|
348
|
+
fontWeight: 'bold'
|
|
349
|
+
}
|
|
350
|
+
}, currentNode === null || currentNode === void 0 ? void 0 : currentNode.label), /*#__PURE__*/React.createElement(Stack, {
|
|
357
351
|
direction: 'row',
|
|
358
352
|
flexWrap: 'wrap',
|
|
359
353
|
sx: {
|
|
@@ -394,18 +388,26 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
394
388
|
tip: '增加缩进',
|
|
395
389
|
disabled: !canCurrentNodeIndent()
|
|
396
390
|
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
397
|
-
key: '
|
|
391
|
+
key: 'format',
|
|
392
|
+
disabled: !hasMarks,
|
|
398
393
|
onClick: function onClick() {
|
|
399
394
|
if (current.node && current.pos !== undefined) {
|
|
400
|
-
|
|
395
|
+
var _current$node3;
|
|
396
|
+
var selection = current.editor.commands.setTextSelection({
|
|
397
|
+
from: current.pos,
|
|
398
|
+
to: current.pos + ((_current$node3 = current.node) === null || _current$node3 === void 0 ? void 0 : _current$node3.nodeSize)
|
|
399
|
+
});
|
|
400
|
+
if (selection) {
|
|
401
|
+
current.editor.chain().unsetAllMarks().focus(current.pos - 1).run();
|
|
402
|
+
}
|
|
401
403
|
}
|
|
402
404
|
},
|
|
403
|
-
icon: /*#__PURE__*/React.createElement(
|
|
405
|
+
icon: /*#__PURE__*/React.createElement(EraserLineIcon, {
|
|
404
406
|
sx: {
|
|
405
407
|
fontSize: '1rem'
|
|
406
408
|
}
|
|
407
409
|
}),
|
|
408
|
-
tip: '
|
|
410
|
+
tip: '清除格式'
|
|
409
411
|
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
410
412
|
key: 'copy',
|
|
411
413
|
onClick: /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -535,17 +537,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
535
537
|
my: 0.5
|
|
536
538
|
}
|
|
537
539
|
})),
|
|
538
|
-
list: [{
|
|
539
|
-
customLabel: /*#__PURE__*/React.createElement(Typography, {
|
|
540
|
-
sx: {
|
|
541
|
-
p: 1,
|
|
542
|
-
fontSize: '0.75rem',
|
|
543
|
-
color: 'text.secondary',
|
|
544
|
-
fontWeight: 'bold'
|
|
545
|
-
}
|
|
546
|
-
}, currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
547
|
-
key: 'current-node'
|
|
548
|
-
}].concat(_toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.color ? [{
|
|
540
|
+
list: [].concat(_toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.color ? [{
|
|
549
541
|
key: 'color',
|
|
550
542
|
label: '颜色',
|
|
551
543
|
maxHeight: 400,
|
|
@@ -866,7 +858,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
866
858
|
}),
|
|
867
859
|
children: [{
|
|
868
860
|
label: '文本',
|
|
869
|
-
selected: ((_current$
|
|
861
|
+
selected: ((_current$node4 = current.node) === null || _current$node4 === void 0 ? void 0 : _current$node4.type.name) === 'paragraph',
|
|
870
862
|
key: 'convert-to-paragraph',
|
|
871
863
|
icon: /*#__PURE__*/React.createElement(TextIcon, {
|
|
872
864
|
sx: {
|
|
@@ -889,7 +881,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
889
881
|
}
|
|
890
882
|
}, {
|
|
891
883
|
label: '标题1',
|
|
892
|
-
selected: ((_current$
|
|
884
|
+
selected: ((_current$node5 = current.node) === null || _current$node5 === void 0 ? void 0 : _current$node5.type.name) === 'heading' && ((_current$node6 = current.node) === null || _current$node6 === void 0 ? void 0 : _current$node6.attrs.level) === 1,
|
|
893
885
|
key: 'convert-to-heading-1',
|
|
894
886
|
icon: /*#__PURE__*/React.createElement(H1Icon, {
|
|
895
887
|
sx: {
|
|
@@ -915,7 +907,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
915
907
|
}
|
|
916
908
|
}, {
|
|
917
909
|
label: '标题2',
|
|
918
|
-
selected: ((_current$
|
|
910
|
+
selected: ((_current$node7 = current.node) === null || _current$node7 === void 0 ? void 0 : _current$node7.type.name) === 'heading' && ((_current$node8 = current.node) === null || _current$node8 === void 0 ? void 0 : _current$node8.attrs.level) === 2,
|
|
919
911
|
key: 'convert-to-heading-2',
|
|
920
912
|
icon: /*#__PURE__*/React.createElement(H2Icon, {
|
|
921
913
|
sx: {
|
|
@@ -941,7 +933,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
941
933
|
}
|
|
942
934
|
}, {
|
|
943
935
|
label: '标题3',
|
|
944
|
-
selected: ((_current$
|
|
936
|
+
selected: ((_current$node9 = current.node) === null || _current$node9 === void 0 ? void 0 : _current$node9.type.name) === 'heading' && ((_current$node10 = current.node) === null || _current$node10 === void 0 ? void 0 : _current$node10.attrs.level) === 3,
|
|
945
937
|
key: 'convert-to-heading-3',
|
|
946
938
|
icon: /*#__PURE__*/React.createElement(H3Icon, {
|
|
947
939
|
sx: {
|
|
@@ -974,7 +966,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
974
966
|
key: 'divider2'
|
|
975
967
|
}, {
|
|
976
968
|
label: '有序列表',
|
|
977
|
-
selected: ((_current$
|
|
969
|
+
selected: ((_current$node11 = current.node) === null || _current$node11 === void 0 ? void 0 : _current$node11.type.name) === 'orderedList',
|
|
978
970
|
key: 'convert-to-ordered-list',
|
|
979
971
|
icon: /*#__PURE__*/React.createElement(ListOrdered2Icon, {
|
|
980
972
|
sx: {
|
|
@@ -997,7 +989,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
997
989
|
}
|
|
998
990
|
}, {
|
|
999
991
|
label: '无序列表',
|
|
1000
|
-
selected: ((_current$
|
|
992
|
+
selected: ((_current$node12 = current.node) === null || _current$node12 === void 0 ? void 0 : _current$node12.type.name) === 'bulletList',
|
|
1001
993
|
key: 'convert-to-bullet-list',
|
|
1002
994
|
icon: /*#__PURE__*/React.createElement(ListUnorderedIcon, {
|
|
1003
995
|
sx: {
|
|
@@ -1020,7 +1012,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1020
1012
|
}
|
|
1021
1013
|
}, {
|
|
1022
1014
|
label: '任务列表',
|
|
1023
|
-
selected: ((_current$
|
|
1015
|
+
selected: ((_current$node13 = current.node) === null || _current$node13 === void 0 ? void 0 : _current$node13.type.name) === 'taskList',
|
|
1024
1016
|
key: 'convert-to-task-list',
|
|
1025
1017
|
icon: /*#__PURE__*/React.createElement(ListCheck3Icon, {
|
|
1026
1018
|
sx: {
|
|
@@ -1050,7 +1042,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1050
1042
|
key: 'divider3'
|
|
1051
1043
|
}, {
|
|
1052
1044
|
label: '引用',
|
|
1053
|
-
selected: ((_current$
|
|
1045
|
+
selected: ((_current$node14 = current.node) === null || _current$node14 === void 0 ? void 0 : _current$node14.type.name) === 'blockquote',
|
|
1054
1046
|
key: 'convert-to-blockquote',
|
|
1055
1047
|
icon: /*#__PURE__*/React.createElement(QuoteTextIcon, {
|
|
1056
1048
|
sx: {
|
|
@@ -1073,7 +1065,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1073
1065
|
}
|
|
1074
1066
|
}, {
|
|
1075
1067
|
label: '警告块',
|
|
1076
|
-
selected: ((_current$
|
|
1068
|
+
selected: ((_current$node15 = current.node) === null || _current$node15 === void 0 ? void 0 : _current$node15.type.name) === 'alert',
|
|
1077
1069
|
key: 'convert-to-alert',
|
|
1078
1070
|
icon: /*#__PURE__*/React.createElement(Information2LineIcon, {
|
|
1079
1071
|
sx: {
|
|
@@ -1102,7 +1094,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1102
1094
|
}
|
|
1103
1095
|
}
|
|
1104
1096
|
}]
|
|
1105
|
-
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.download && ((_current$
|
|
1097
|
+
}] : []), _toConsumableArray(currentNode !== null && currentNode !== void 0 && currentNode.download && ((_current$node16 = current.node) !== null && _current$node16 !== void 0 && _current$node16.attrs.src || (_current$node17 = current.node) !== null && _current$node17 !== void 0 && _current$node17.attrs.src) ? [{
|
|
1106
1098
|
label: "\u4E0B\u8F7D".concat(currentNode === null || currentNode === void 0 ? void 0 : currentNode.label),
|
|
1107
1099
|
key: 'download',
|
|
1108
1100
|
icon: /*#__PURE__*/React.createElement(DownloadLineIcon, {
|
|
@@ -1112,7 +1104,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1112
1104
|
}),
|
|
1113
1105
|
onClick: function () {
|
|
1114
1106
|
var _onClick = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
1115
|
-
var _current$
|
|
1107
|
+
var _current$node18, node, nodeFile, nodeBlob, nodeUrl, nodeName, a;
|
|
1116
1108
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1117
1109
|
while (1) switch (_context3.prev = _context3.next) {
|
|
1118
1110
|
case 0:
|
|
@@ -1120,7 +1112,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1120
1112
|
_context3.next = 16;
|
|
1121
1113
|
break;
|
|
1122
1114
|
}
|
|
1123
|
-
if (![NodeTypeEnum.Video, NodeTypeEnum.Audio, NodeTypeEnum.BlockAttachment].includes((_current$
|
|
1115
|
+
if (![NodeTypeEnum.Video, NodeTypeEnum.Audio, NodeTypeEnum.BlockAttachment].includes((_current$node18 = current.node) === null || _current$node18 === void 0 ? void 0 : _current$node18.type.name)) {
|
|
1124
1116
|
_context3.next = 16;
|
|
1125
1117
|
break;
|
|
1126
1118
|
}
|
|
@@ -1383,27 +1375,7 @@ var CustomDragHandle = function CustomDragHandle(_ref3) {
|
|
|
1383
1375
|
}
|
|
1384
1376
|
return onClick;
|
|
1385
1377
|
}()
|
|
1386
|
-
}] : []))), _toConsumableArray(more ? more : [])
|
|
1387
|
-
label: '文本格式化',
|
|
1388
|
-
key: 'format',
|
|
1389
|
-
icon: /*#__PURE__*/React.createElement(EraserLineIcon, {
|
|
1390
|
-
sx: {
|
|
1391
|
-
fontSize: '1rem'
|
|
1392
|
-
}
|
|
1393
|
-
}),
|
|
1394
|
-
onClick: function onClick() {
|
|
1395
|
-
if (current.node && current.pos !== undefined) {
|
|
1396
|
-
var _current$node18;
|
|
1397
|
-
var selection = current.editor.commands.setTextSelection({
|
|
1398
|
-
from: current.pos,
|
|
1399
|
-
to: current.pos + ((_current$node18 = current.node) === null || _current$node18 === void 0 ? void 0 : _current$node18.nodeSize)
|
|
1400
|
-
});
|
|
1401
|
-
if (selection) {
|
|
1402
|
-
current.editor.chain().unsetAllMarks().focus(current.pos - 1).run();
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
}] : []))
|
|
1378
|
+
}] : []))), _toConsumableArray(more ? more : []))
|
|
1407
1379
|
}) : /*#__PURE__*/React.createElement(DragIcon, null)));
|
|
1408
1380
|
};
|
|
1409
1381
|
export default CustomDragHandle;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import { SvgIcon } from "@mui/material";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
export var EmotionLineIcon = function EmotionLineIcon(props) {
|
|
5
|
+
return /*#__PURE__*/React.createElement(SvgIcon, _extends({
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
version: "1.1",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
10
|
+
d: "M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"
|
|
11
|
+
}));
|
|
12
|
+
};
|
|
13
|
+
EmotionLineIcon.displayName = 'icon-emotion-line';
|
|
@@ -42,6 +42,7 @@ export { DownloadLineIcon } from './download-line-icon';
|
|
|
42
42
|
export { DraggableIcon } from './draggable-icon';
|
|
43
43
|
export { EditBoxLineIcon } from './edit-box-line-icon';
|
|
44
44
|
export { EditLineIcon } from './edit-line-icon';
|
|
45
|
+
export { EmotionLineIcon } from './emotion-line-icon';
|
|
45
46
|
export { EraserLineIcon } from './eraser-line-icon';
|
|
46
47
|
export { ErrorWarningFillIcon } from './error-warning-fill-icon';
|
|
47
48
|
export { ExpendIcon } from './expend-icon';
|
|
@@ -45,6 +45,7 @@ export { DownloadLineIcon } from "./download-line-icon";
|
|
|
45
45
|
export { DraggableIcon } from "./draggable-icon";
|
|
46
46
|
export { EditBoxLineIcon } from "./edit-box-line-icon";
|
|
47
47
|
export { EditLineIcon } from "./edit-line-icon";
|
|
48
|
+
export { EmotionLineIcon } from "./emotion-line-icon";
|
|
48
49
|
export { EraserLineIcon } from "./eraser-line-icon";
|
|
49
50
|
export { ErrorWarningFillIcon } from "./error-warning-fill-icon";
|
|
50
51
|
export { ExpendIcon } from "./expend-icon";
|
|
@@ -3,7 +3,7 @@ import { PopoverOrigin } from '@mui/material';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export interface NestedMenuListProps {
|
|
5
5
|
list: MenuItem[];
|
|
6
|
-
width?:
|
|
6
|
+
width?: React.CSSProperties['width'];
|
|
7
7
|
arrowIcon?: React.ReactNode;
|
|
8
8
|
childrenProps?: {
|
|
9
9
|
anchorOrigin?: PopoverOrigin;
|
|
@@ -11,6 +11,7 @@ var Menu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
11
11
|
var _ref$id = _ref.id,
|
|
12
12
|
id = _ref$id === void 0 ? 'menu-select' : _ref$id,
|
|
13
13
|
width = _ref.width,
|
|
14
|
+
maxHeight = _ref.maxHeight,
|
|
14
15
|
arrowIcon = _ref.arrowIcon,
|
|
15
16
|
list = _ref.list,
|
|
16
17
|
_ref$header = _ref.header,
|
|
@@ -84,7 +85,9 @@ var Menu = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
84
85
|
} : undefined
|
|
85
86
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
86
87
|
sx: {
|
|
87
|
-
p: 0.5
|
|
88
|
+
p: 0.5,
|
|
89
|
+
maxHeight: maxHeight,
|
|
90
|
+
overflowY: 'auto'
|
|
88
91
|
}
|
|
89
92
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
90
93
|
onClick: handleClose
|