@ctzhian/tiptap 1.11.4 → 1.12.1
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 +17 -22
- package/dist/EditorMarkdown/index.js +1 -1
- package/dist/asset/css/index.css +19 -8
- package/dist/component/ActionDropdown/index.d.ts +25 -0
- package/dist/component/ActionDropdown/index.js +147 -0
- package/dist/component/CustomDragHandle/index.js +2 -2
- package/dist/component/FloatingPopover/index.d.ts +2 -0
- package/dist/component/FloatingPopover/index.js +7 -1
- package/dist/component/HoverPopover/index.d.ts +29 -0
- package/dist/component/HoverPopover/index.js +143 -0
- package/dist/component/Icons/chrome-icon.d.ts +6 -0
- package/dist/component/Icons/chrome-icon.js +31 -0
- package/dist/component/Icons/edit-line-icon.d.ts +6 -0
- package/dist/component/Icons/edit-line-icon.js +13 -0
- package/dist/component/Icons/file-icon.d.ts +6 -0
- package/dist/component/Icons/file-icon.js +20 -0
- package/dist/component/Icons/index.d.ts +3 -0
- package/dist/component/Icons/index.js +3 -0
- package/dist/component/index.d.ts +2 -0
- package/dist/component/index.js +2 -0
- package/dist/extension/component/Alert/index.js +73 -85
- package/dist/extension/component/Attachment/AttachmentContent.d.ts +14 -0
- package/dist/extension/component/Attachment/AttachmentContent.js +142 -0
- package/dist/extension/component/Attachment/index.js +144 -201
- package/dist/extension/component/CodeBlock/Readonly.js +42 -35
- package/dist/extension/component/CodeBlock/index.js +137 -90
- package/dist/extension/component/Image/Insert.js +41 -26
- package/dist/extension/component/Image/Readonly.js +13 -6
- package/dist/extension/component/Image/index.d.ts +1 -0
- package/dist/extension/component/Image/index.js +234 -92
- package/dist/extension/component/Link/Insert.js +1 -1
- package/dist/extension/component/Link/LinkContent.d.ts +13 -0
- package/dist/extension/component/Link/LinkContent.js +169 -0
- package/dist/extension/component/Link/index.js +182 -264
- package/dist/extension/component/MentionList/index.js +1 -1
- package/dist/extension/index.js +1 -1
- package/dist/index.css +65 -63
- package/dist/themes/dark.js +2 -2
- package/dist/themes/light.d.ts +1 -1
- package/dist/themes/light.js +2 -2
- package/dist/themes/palette.d.ts +1 -1
- package/package.json +1 -1
- package/dist/extension/component/Attachment/Readonly.d.ts +0 -9
- package/dist/extension/component/Attachment/Readonly.js +0 -91
- package/dist/extension/component/CustomLink/Insert.d.ts +0 -0
- package/dist/extension/component/CustomLink/Insert.js +0 -176
- package/dist/extension/component/CustomLink/Readonly.d.ts +0 -0
- package/dist/extension/component/CustomLink/Readonly.js +0 -106
- package/dist/extension/component/CustomLink/index.d.ts +0 -0
- package/dist/extension/component/CustomLink/index.js +0 -440
- package/dist/extension/component/Link/Readonly.d.ts +0 -8
- package/dist/extension/component/Link/Readonly.js +0 -110
|
@@ -9,21 +9,21 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
9
9
|
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; }
|
|
10
10
|
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; } }
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
-
import { FloatingPopover } from "../../../component";
|
|
13
|
-
import { CarouselViewIcon, CopyIcon,
|
|
12
|
+
import { ActionDropdown, FloatingPopover, HoverPopover } from "../../../component";
|
|
13
|
+
import { CarouselViewIcon, CopyIcon, EditLineIcon, LinkUnlinkIcon, ScrollToBottomLineIcon, TextIcon } from "../../../component/Icons";
|
|
14
14
|
import { ToolbarItem } from "../../../component/Toolbar";
|
|
15
|
-
import {
|
|
16
|
-
import { Avatar, Box, Button, Divider, FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, Stack, TextField } from "@mui/material";
|
|
15
|
+
import { Box, Button, Divider, FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, Stack, TextField } from "@mui/material";
|
|
17
16
|
import { NodeViewWrapper } from "@tiptap/react";
|
|
18
17
|
import React, { useCallback, useEffect, useState } from "react";
|
|
19
18
|
import InsertLink from "./Insert";
|
|
20
|
-
import
|
|
19
|
+
import { LinkContent } from "./LinkContent";
|
|
21
20
|
var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
22
21
|
var editor = _ref.editor,
|
|
23
22
|
node = _ref.node,
|
|
24
23
|
updateAttributes = _ref.updateAttributes,
|
|
25
24
|
deleteNode = _ref.deleteNode,
|
|
26
|
-
selected = _ref.selected
|
|
25
|
+
selected = _ref.selected,
|
|
26
|
+
getPos = _ref.getPos;
|
|
27
27
|
var isMarkdown = editor.options.contentType === 'markdown';
|
|
28
28
|
var attrs = node.attrs;
|
|
29
29
|
var _useState = useState(attrs.title || ''),
|
|
@@ -44,46 +44,173 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
44
44
|
setTarget = _useState8[1];
|
|
45
45
|
var _useState9 = useState(null),
|
|
46
46
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
_useState12 = _slicedToArray(_useState11, 2),
|
|
51
|
-
anchorEl = _useState12[0],
|
|
52
|
-
setAnchorEl = _useState12[1];
|
|
47
|
+
anchorEl = _useState10[0],
|
|
48
|
+
setAnchorEl = _useState10[1];
|
|
49
|
+
var linkContentRef = React.useRef(null);
|
|
53
50
|
useEffect(function () {
|
|
54
51
|
setTitle(attrs.title || '');
|
|
55
52
|
setHref(attrs.href || '');
|
|
56
53
|
setType(attrs.type || 'icon');
|
|
57
54
|
setTarget(attrs.target || '_blank');
|
|
58
55
|
}, [attrs.title, attrs.href, attrs.type, attrs.target]);
|
|
59
|
-
var
|
|
60
|
-
|
|
56
|
+
var handleShowPopover = function handleShowPopover() {
|
|
57
|
+
setAnchorEl(linkContentRef.current);
|
|
61
58
|
};
|
|
62
|
-
var
|
|
63
|
-
return
|
|
59
|
+
var handleClosePopover = function handleClosePopover() {
|
|
60
|
+
return setAnchorEl(null);
|
|
64
61
|
};
|
|
65
|
-
var
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
var handleConvertLinkType = function handleConvertLinkType(newType) {
|
|
63
|
+
if (type === 'block') {
|
|
64
|
+
var pos = getPos();
|
|
65
|
+
if (typeof pos === 'number') {
|
|
66
|
+
editor.chain().focus().deleteRange({
|
|
67
|
+
from: pos,
|
|
68
|
+
to: pos + node.nodeSize
|
|
69
|
+
}).insertContentAt(pos, {
|
|
70
|
+
type: 'inlineLink',
|
|
71
|
+
attrs: {
|
|
72
|
+
title: attrs.title,
|
|
73
|
+
href: attrs.href,
|
|
74
|
+
type: newType,
|
|
75
|
+
target: attrs.target,
|
|
76
|
+
class: attrs.class,
|
|
77
|
+
rel: attrs.rel
|
|
78
|
+
}
|
|
79
|
+
}).run();
|
|
80
|
+
}
|
|
69
81
|
} else {
|
|
70
|
-
|
|
82
|
+
updateAttributes({
|
|
83
|
+
type: newType
|
|
84
|
+
});
|
|
71
85
|
}
|
|
72
86
|
};
|
|
73
|
-
var
|
|
74
|
-
return
|
|
87
|
+
var renderOperationActions = function renderOperationActions() {
|
|
88
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
89
|
+
direction: 'row',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
sx: {
|
|
92
|
+
p: 0.5
|
|
93
|
+
}
|
|
94
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
95
|
+
className: "text-ellipsis",
|
|
96
|
+
sx: {
|
|
97
|
+
fontSize: '0.875rem',
|
|
98
|
+
color: 'text.secondary',
|
|
99
|
+
flexShrink: 0,
|
|
100
|
+
px: 1,
|
|
101
|
+
width: 200
|
|
102
|
+
}
|
|
103
|
+
}, attrs.href), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
104
|
+
icon: /*#__PURE__*/React.createElement(EditLineIcon, {
|
|
105
|
+
sx: {
|
|
106
|
+
fontSize: '1rem'
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
tip: "\u7F16\u8F91",
|
|
110
|
+
onClick: handleShowPopover
|
|
111
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
112
|
+
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
113
|
+
sx: {
|
|
114
|
+
fontSize: '1rem'
|
|
115
|
+
}
|
|
116
|
+
}),
|
|
117
|
+
tip: "\u590D\u5236",
|
|
118
|
+
onClick: handleCopyLink
|
|
119
|
+
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
120
|
+
icon: /*#__PURE__*/React.createElement(LinkUnlinkIcon, {
|
|
121
|
+
sx: {
|
|
122
|
+
fontSize: '1rem'
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
tip: "\u53D6\u6D88\u94FE\u63A5",
|
|
126
|
+
onClick: handleDeleteLink
|
|
127
|
+
}), !isMarkdown && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
128
|
+
orientation: "vertical",
|
|
129
|
+
flexItem: true,
|
|
130
|
+
sx: {
|
|
131
|
+
height: '1rem',
|
|
132
|
+
mx: 0.5,
|
|
133
|
+
alignSelf: 'center',
|
|
134
|
+
borderColor: 'divider'
|
|
135
|
+
}
|
|
136
|
+
}), /*#__PURE__*/React.createElement(ActionDropdown, {
|
|
137
|
+
id: "link-type-dropdown",
|
|
138
|
+
selected: type,
|
|
139
|
+
list: [{
|
|
140
|
+
key: 'text',
|
|
141
|
+
label: '文字',
|
|
142
|
+
icon: /*#__PURE__*/React.createElement(TextIcon, {
|
|
143
|
+
sx: {
|
|
144
|
+
fontSize: '1rem'
|
|
145
|
+
}
|
|
146
|
+
}),
|
|
147
|
+
onClick: function onClick() {
|
|
148
|
+
return handleConvertLinkType('text');
|
|
149
|
+
}
|
|
150
|
+
}, {
|
|
151
|
+
key: 'icon',
|
|
152
|
+
label: '图标文字',
|
|
153
|
+
icon: /*#__PURE__*/React.createElement(ScrollToBottomLineIcon, {
|
|
154
|
+
sx: {
|
|
155
|
+
transform: 'rotate(90deg)',
|
|
156
|
+
fontSize: '1rem'
|
|
157
|
+
}
|
|
158
|
+
}),
|
|
159
|
+
onClick: function onClick() {
|
|
160
|
+
return handleConvertLinkType('icon');
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: 'block',
|
|
164
|
+
label: '卡片',
|
|
165
|
+
icon: /*#__PURE__*/React.createElement(CarouselViewIcon, {
|
|
166
|
+
sx: {
|
|
167
|
+
transform: 'rotate(90deg)',
|
|
168
|
+
fontSize: '1rem'
|
|
169
|
+
}
|
|
170
|
+
}),
|
|
171
|
+
onClick: function onClick() {
|
|
172
|
+
// 获取当前节点位置,确保在正确位置插入新节点
|
|
173
|
+
var pos = getPos();
|
|
174
|
+
if (typeof pos === 'number') {
|
|
175
|
+
editor.chain().focus().deleteRange({
|
|
176
|
+
from: pos,
|
|
177
|
+
to: pos + node.nodeSize
|
|
178
|
+
}).insertContentAt(pos, {
|
|
179
|
+
type: 'blockLink',
|
|
180
|
+
attrs: {
|
|
181
|
+
title: attrs.title,
|
|
182
|
+
href: attrs.href,
|
|
183
|
+
type: 'block',
|
|
184
|
+
target: attrs.target,
|
|
185
|
+
class: attrs.class,
|
|
186
|
+
rel: attrs.rel
|
|
187
|
+
}
|
|
188
|
+
}).run();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}]
|
|
192
|
+
})));
|
|
75
193
|
};
|
|
76
194
|
var handleSave = function handleSave() {
|
|
77
195
|
if (type === 'block') {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
196
|
+
// 获取当前节点位置,确保在正确位置插入新节点
|
|
197
|
+
var pos = getPos();
|
|
198
|
+
if (typeof pos === 'number') {
|
|
199
|
+
editor.chain().focus().deleteRange({
|
|
200
|
+
from: pos,
|
|
201
|
+
to: pos + node.nodeSize
|
|
202
|
+
}).insertContentAt(pos, {
|
|
203
|
+
type: 'blockLink',
|
|
204
|
+
attrs: {
|
|
205
|
+
title: title,
|
|
206
|
+
href: href,
|
|
207
|
+
type: type,
|
|
208
|
+
target: target,
|
|
209
|
+
class: attrs.class,
|
|
210
|
+
rel: attrs.rel
|
|
211
|
+
}
|
|
212
|
+
}).run();
|
|
213
|
+
}
|
|
87
214
|
} else {
|
|
88
215
|
updateAttributes === null || updateAttributes === void 0 || updateAttributes({
|
|
89
216
|
title: title,
|
|
@@ -95,8 +222,14 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
95
222
|
handleClosePopover();
|
|
96
223
|
};
|
|
97
224
|
var handleDeleteLink = function handleDeleteLink() {
|
|
98
|
-
|
|
99
|
-
|
|
225
|
+
// 获取当前节点位置,确保在正确位置插入文本
|
|
226
|
+
var pos = getPos();
|
|
227
|
+
if (typeof pos === 'number') {
|
|
228
|
+
editor.chain().focus().deleteRange({
|
|
229
|
+
from: pos,
|
|
230
|
+
to: pos + node.nodeSize
|
|
231
|
+
}).insertContentAt(pos, attrs.title || attrs.href).run();
|
|
232
|
+
}
|
|
100
233
|
};
|
|
101
234
|
var handleCopyLink = useCallback( /*#__PURE__*/function () {
|
|
102
235
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
@@ -124,18 +257,16 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
124
257
|
return _ref2.apply(this, arguments);
|
|
125
258
|
};
|
|
126
259
|
}(), [attrs.href]);
|
|
127
|
-
var favicon = '';
|
|
128
|
-
try {
|
|
129
|
-
favicon = attrs.href ? new URL(attrs.href).origin + '/favicon.ico' : '';
|
|
130
|
-
} catch (err) {}
|
|
131
260
|
if (!attrs.href && !editor.isEditable) {
|
|
132
261
|
return null;
|
|
133
262
|
}
|
|
134
263
|
if (!editor.isEditable) {
|
|
135
|
-
return /*#__PURE__*/React.createElement(
|
|
264
|
+
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
265
|
+
className: "link-wrapper"
|
|
266
|
+
}, /*#__PURE__*/React.createElement(LinkContent, {
|
|
136
267
|
attrs: attrs,
|
|
137
|
-
|
|
138
|
-
});
|
|
268
|
+
editable: false
|
|
269
|
+
}));
|
|
139
270
|
}
|
|
140
271
|
if (!attrs.href) {
|
|
141
272
|
return /*#__PURE__*/React.createElement(InsertLink, {
|
|
@@ -151,229 +282,16 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
151
282
|
as: attrs.type === 'block' ? 'div' : 'span'
|
|
152
283
|
}, attrs.type === 'block' ? {
|
|
153
284
|
'data-drag-handle': true
|
|
154
|
-
} : {}),
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
sx: {
|
|
160
|
-
border: '1px solid',
|
|
161
|
-
borderColor: 'divider',
|
|
162
|
-
cursor: 'pointer',
|
|
163
|
-
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
164
|
-
p: 2,
|
|
165
|
-
':hover': {
|
|
166
|
-
borderColor: 'primary.main',
|
|
167
|
-
color: 'primary.main'
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}, /*#__PURE__*/React.createElement(Avatar, {
|
|
171
|
-
sx: {
|
|
172
|
-
width: '2rem',
|
|
173
|
-
height: '2rem',
|
|
174
|
-
alignSelf: 'center',
|
|
175
|
-
bgcolor: '#FFFFFF'
|
|
176
|
-
},
|
|
177
|
-
src: favicon
|
|
178
|
-
}, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
179
|
-
sx: {
|
|
180
|
-
fontSize: '2rem',
|
|
181
|
-
cursor: 'grab',
|
|
182
|
-
color: 'primary.main',
|
|
183
|
-
alignSelf: 'center',
|
|
184
|
-
':active': {
|
|
185
|
-
cursor: 'grabbing'
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
})), /*#__PURE__*/React.createElement(Stack, {
|
|
189
|
-
sx: {
|
|
190
|
-
flex: 1
|
|
191
|
-
},
|
|
192
|
-
gap: 0.5
|
|
193
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
194
|
-
sx: {
|
|
195
|
-
fontSize: '0.875rem',
|
|
196
|
-
fontWeight: 'bold'
|
|
197
|
-
}
|
|
198
|
-
}, attrs.title || getLinkTitle(attrs.href)), /*#__PURE__*/React.createElement(Box, {
|
|
199
|
-
sx: {
|
|
200
|
-
fontSize: '0.75rem',
|
|
201
|
-
color: 'text.secondary'
|
|
202
|
-
}
|
|
203
|
-
}, attrs.href))) : /*#__PURE__*/React.createElement(Box, {
|
|
204
|
-
component: 'span',
|
|
205
|
-
onClick: handleShowOperationPopover,
|
|
206
|
-
sx: {
|
|
207
|
-
color: 'primary.main',
|
|
208
|
-
cursor: 'pointer',
|
|
209
|
-
borderRadius: 'var(--mui-shape-borderRadius)',
|
|
210
|
-
transition: 'background-color 0.2s ease',
|
|
211
|
-
':hover': {
|
|
212
|
-
bgcolor: 'action.hover'
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
216
|
-
component: 'span',
|
|
217
|
-
sx: {
|
|
218
|
-
textDecoration: 'underline',
|
|
219
|
-
display: 'inline-flex',
|
|
220
|
-
alignItems: 'baseline',
|
|
221
|
-
gap: 0.5,
|
|
222
|
-
fontWeight: 500
|
|
223
|
-
}
|
|
224
|
-
}, attrs.type === 'icon' && /*#__PURE__*/React.createElement(Avatar, {
|
|
225
|
-
sx: {
|
|
226
|
-
width: '1rem',
|
|
227
|
-
height: '1rem',
|
|
228
|
-
alignSelf: 'center',
|
|
229
|
-
bgcolor: '#FFFFFF'
|
|
230
|
-
},
|
|
231
|
-
src: favicon
|
|
232
|
-
}, /*#__PURE__*/React.createElement(LinkIcon, {
|
|
233
|
-
sx: {
|
|
234
|
-
fontSize: '1rem',
|
|
235
|
-
cursor: 'grab',
|
|
236
|
-
color: 'primary.main',
|
|
237
|
-
alignSelf: 'center',
|
|
238
|
-
':active': {
|
|
239
|
-
cursor: 'grabbing'
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
})), attrs.title || getLinkTitle(attrs.href))), /*#__PURE__*/React.createElement(FloatingPopover, {
|
|
243
|
-
open: Boolean(opraAnchorEl),
|
|
244
|
-
anchorEl: opraAnchorEl,
|
|
245
|
-
onClose: handleCloseOperationPopover,
|
|
285
|
+
} : {}), /*#__PURE__*/React.createElement("div", {
|
|
286
|
+
ref: linkContentRef
|
|
287
|
+
}, /*#__PURE__*/React.createElement(HoverPopover, {
|
|
288
|
+
actions: renderOperationActions(),
|
|
289
|
+
hoverDelay: 500,
|
|
246
290
|
placement: "top"
|
|
247
|
-
}, /*#__PURE__*/React.createElement(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
p: 0.5
|
|
252
|
-
}
|
|
253
|
-
}, /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
254
|
-
icon: /*#__PURE__*/React.createElement(ShareBoxLineIcon, {
|
|
255
|
-
sx: {
|
|
256
|
-
fontSize: '1rem'
|
|
257
|
-
}
|
|
258
|
-
}),
|
|
259
|
-
text: "\u6253\u5F00",
|
|
260
|
-
onClick: function onClick() {
|
|
261
|
-
window.open(attrs.href, attrs.target);
|
|
262
|
-
}
|
|
263
|
-
}), /*#__PURE__*/React.createElement(Divider, {
|
|
264
|
-
orientation: "vertical",
|
|
265
|
-
flexItem: true,
|
|
266
|
-
sx: {
|
|
267
|
-
height: '1rem',
|
|
268
|
-
mx: 0.5,
|
|
269
|
-
alignSelf: 'center',
|
|
270
|
-
borderColor: 'divider'
|
|
271
|
-
}
|
|
272
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
273
|
-
icon: /*#__PURE__*/React.createElement(EditBoxLineIcon, {
|
|
274
|
-
sx: {
|
|
275
|
-
fontSize: '1rem'
|
|
276
|
-
}
|
|
277
|
-
}),
|
|
278
|
-
tip: "\u7F16\u8F91",
|
|
279
|
-
onClick: function onClick() {
|
|
280
|
-
handleCloseOperationPopover();
|
|
281
|
-
handleShowPopover();
|
|
282
|
-
}
|
|
283
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
284
|
-
icon: /*#__PURE__*/React.createElement(CopyIcon, {
|
|
285
|
-
sx: {
|
|
286
|
-
fontSize: '1rem'
|
|
287
|
-
}
|
|
288
|
-
}),
|
|
289
|
-
tip: "\u590D\u5236",
|
|
290
|
-
onClick: handleCopyLink
|
|
291
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
292
|
-
icon: /*#__PURE__*/React.createElement(LinkUnlinkIcon, {
|
|
293
|
-
sx: {
|
|
294
|
-
fontSize: '1rem'
|
|
295
|
-
}
|
|
296
|
-
}),
|
|
297
|
-
tip: "\u53D6\u6D88\u94FE\u63A5",
|
|
298
|
-
onClick: handleDeleteLink
|
|
299
|
-
}), !isMarkdown && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Divider, {
|
|
300
|
-
orientation: "vertical",
|
|
301
|
-
flexItem: true,
|
|
302
|
-
sx: {
|
|
303
|
-
height: '1rem',
|
|
304
|
-
mx: 0.5,
|
|
305
|
-
alignSelf: 'center',
|
|
306
|
-
borderColor: 'divider'
|
|
307
|
-
}
|
|
308
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
309
|
-
icon: /*#__PURE__*/React.createElement(TextIcon, {
|
|
310
|
-
sx: {
|
|
311
|
-
fontSize: '1rem'
|
|
312
|
-
}
|
|
313
|
-
}),
|
|
314
|
-
tip: "\u6587\u5B57\u94FE\u63A5",
|
|
315
|
-
onClick: function onClick() {
|
|
316
|
-
if (type === 'block') {
|
|
317
|
-
editor.commands.deleteNode(node.type);
|
|
318
|
-
editor.commands.setInlineLink({
|
|
319
|
-
title: attrs.title,
|
|
320
|
-
href: attrs.href,
|
|
321
|
-
type: 'text'
|
|
322
|
-
});
|
|
323
|
-
} else {
|
|
324
|
-
updateAttributes({
|
|
325
|
-
type: 'text'
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
},
|
|
329
|
-
className: type === 'text' ? 'tool-active' : ''
|
|
330
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
331
|
-
icon: /*#__PURE__*/React.createElement(ScrollToBottomLineIcon, {
|
|
332
|
-
sx: {
|
|
333
|
-
transform: 'rotate(90deg)',
|
|
334
|
-
fontSize: '1rem'
|
|
335
|
-
}
|
|
336
|
-
}),
|
|
337
|
-
tip: "\u56FE\u6807\u6587\u5B57\u94FE\u63A5",
|
|
338
|
-
onClick: function onClick() {
|
|
339
|
-
if (type === 'block') {
|
|
340
|
-
editor.commands.deleteNode(node.type);
|
|
341
|
-
editor.commands.setInlineLink({
|
|
342
|
-
title: attrs.title,
|
|
343
|
-
href: attrs.href,
|
|
344
|
-
type: 'icon',
|
|
345
|
-
target: attrs.target,
|
|
346
|
-
class: attrs.class,
|
|
347
|
-
rel: attrs.rel
|
|
348
|
-
});
|
|
349
|
-
} else {
|
|
350
|
-
updateAttributes({
|
|
351
|
-
type: 'icon'
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
className: type === 'icon' ? 'tool-active' : ''
|
|
356
|
-
}), /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
357
|
-
icon: /*#__PURE__*/React.createElement(CarouselViewIcon, {
|
|
358
|
-
sx: {
|
|
359
|
-
transform: 'rotate(90deg)',
|
|
360
|
-
fontSize: '1rem'
|
|
361
|
-
}
|
|
362
|
-
}),
|
|
363
|
-
tip: "\u6458\u8981\u5361\u7247",
|
|
364
|
-
onClick: function onClick() {
|
|
365
|
-
editor.commands.deleteNode(node.type);
|
|
366
|
-
editor.commands.setBlockLink({
|
|
367
|
-
title: attrs.title,
|
|
368
|
-
href: attrs.href,
|
|
369
|
-
type: 'block',
|
|
370
|
-
target: attrs.target,
|
|
371
|
-
class: attrs.class,
|
|
372
|
-
rel: attrs.rel
|
|
373
|
-
});
|
|
374
|
-
},
|
|
375
|
-
className: type === 'block' ? 'tool-active' : ''
|
|
376
|
-
})))), /*#__PURE__*/React.createElement(FloatingPopover, {
|
|
291
|
+
}, /*#__PURE__*/React.createElement(LinkContent, {
|
|
292
|
+
attrs: attrs,
|
|
293
|
+
editable: true
|
|
294
|
+
}))), /*#__PURE__*/React.createElement(FloatingPopover, {
|
|
377
295
|
open: Boolean(anchorEl),
|
|
378
296
|
anchorEl: anchorEl,
|
|
379
297
|
onClose: handleClosePopover,
|
|
@@ -448,7 +366,7 @@ var LinkViewWrapper = function LinkViewWrapper(_ref) {
|
|
|
448
366
|
control: /*#__PURE__*/React.createElement(Radio, {
|
|
449
367
|
size: "small"
|
|
450
368
|
}),
|
|
451
|
-
label: "\
|
|
369
|
+
label: "\u6587\u5B57"
|
|
452
370
|
}), /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
453
371
|
value: "icon",
|
|
454
372
|
control: /*#__PURE__*/React.createElement(Radio, {
|
package/dist/extension/index.js
CHANGED
|
@@ -104,7 +104,7 @@ export var getExtensions = function getExtensions(_ref) {
|
|
|
104
104
|
}
|
|
105
105
|
}));
|
|
106
106
|
} else {
|
|
107
|
-
defaultExtensions.push.apply(defaultExtensions, [
|
|
107
|
+
defaultExtensions.push.apply(defaultExtensions, [BlockLinkExtension, IframeExtension({
|
|
108
108
|
onError: onError,
|
|
109
109
|
onValidateUrl: onValidateUrl
|
|
110
110
|
}), VideoExtension({
|