@ctzhian/tiptap 1.6.17 → 1.6.19
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.
|
@@ -94,12 +94,11 @@ var EditorToolbar = function EditorToolbar(_ref) {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
},
|
|
98
|
-
editor: editor
|
|
99
|
-
}), editor.options.extensions.find(function (it) {
|
|
97
|
+
}, editor.options.extensions.find(function (it) {
|
|
100
98
|
return it.name === 'aiWriting';
|
|
101
99
|
}) && /*#__PURE__*/React.createElement(ToolbarItem, {
|
|
102
100
|
text: 'AI 伴写',
|
|
101
|
+
tip: "\u5F00\u542F\u540E\u6309\u4E0B Tab \u952E\u91C7\u7EB3\u5EFA\u8BAE",
|
|
103
102
|
icon: /*#__PURE__*/React.createElement(AiGenerate2Icon, {
|
|
104
103
|
sx: {
|
|
105
104
|
fontSize: '1rem'
|
|
@@ -109,6 +108,8 @@ var EditorToolbar = function EditorToolbar(_ref) {
|
|
|
109
108
|
return editor.chain().focus().setAiWriting(!active.aiWriting).run();
|
|
110
109
|
},
|
|
111
110
|
className: active.aiWriting ? 'tool-active' : ''
|
|
111
|
+
}), /*#__PURE__*/React.createElement(EditorInsert, {
|
|
112
|
+
editor: editor
|
|
112
113
|
}), /*#__PURE__*/React.createElement(Divider, {
|
|
113
114
|
orientation: "vertical",
|
|
114
115
|
flexItem: true,
|
|
@@ -149,17 +149,12 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
149
149
|
// 使用当前实际显示的宽度作为拖拽起始点
|
|
150
150
|
setDragStartWidth(getCurrentDisplayWidth());
|
|
151
151
|
};
|
|
152
|
-
var rafRef = useRef(null);
|
|
153
152
|
var handleMouseMove = function handleMouseMove(e) {
|
|
154
153
|
if (!isDragging) return;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var newWidth = Math.max(100, Math.min(1200, dragStartWidth + deltaX));
|
|
160
|
-
updateAttributes({
|
|
161
|
-
width: newWidth
|
|
162
|
-
});
|
|
154
|
+
var deltaX = e.clientX - dragStartX;
|
|
155
|
+
var newWidth = Math.max(100, Math.min(1200, dragStartWidth + deltaX));
|
|
156
|
+
updateAttributes({
|
|
157
|
+
width: newWidth
|
|
163
158
|
});
|
|
164
159
|
};
|
|
165
160
|
var handleMouseUp = function handleMouseUp() {
|
|
@@ -182,7 +177,8 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
182
177
|
var currentWidth = getCurrentDisplayWidth();
|
|
183
178
|
updateAttributes({
|
|
184
179
|
src: editSrc.trim(),
|
|
185
|
-
width: currentWidth
|
|
180
|
+
width: currentWidth,
|
|
181
|
+
error: true
|
|
186
182
|
});
|
|
187
183
|
setEditSrc(editSrc.trim());
|
|
188
184
|
}
|
|
@@ -190,7 +186,6 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
190
186
|
};
|
|
191
187
|
useEffect(function () {
|
|
192
188
|
if (isDragging) {
|
|
193
|
-
setAnchorEl(null);
|
|
194
189
|
document.addEventListener('mousemove', handleMouseMove);
|
|
195
190
|
document.addEventListener('mouseup', handleMouseUp);
|
|
196
191
|
return function () {
|
|
@@ -228,11 +223,9 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
228
223
|
return /*#__PURE__*/React.createElement(NodeViewWrapper, {
|
|
229
224
|
className: "image-wrapper ".concat(selected ? 'ProseMirror-selectednode' : ''),
|
|
230
225
|
as: 'span',
|
|
231
|
-
|
|
232
|
-
"data-drag-handle": false
|
|
226
|
+
'data-drag-handle': false
|
|
233
227
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
234
228
|
component: 'span',
|
|
235
|
-
contentEditable: false,
|
|
236
229
|
sx: {
|
|
237
230
|
position: 'relative',
|
|
238
231
|
display: 'inline-block',
|
|
@@ -265,7 +258,6 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
265
258
|
}
|
|
266
259
|
}), (isHovering || isDragging) && /*#__PURE__*/React.createElement(Box, {
|
|
267
260
|
onMouseDown: handleMouseDown,
|
|
268
|
-
contentEditable: false,
|
|
269
261
|
sx: {
|
|
270
262
|
position: 'absolute',
|
|
271
263
|
right: -2,
|
|
@@ -284,7 +276,6 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
|
|
|
284
276
|
}
|
|
285
277
|
}), (isHovering || !!anchorEl) && /*#__PURE__*/React.createElement(Box, {
|
|
286
278
|
className: "image-controls",
|
|
287
|
-
contentEditable: false,
|
|
288
279
|
sx: {
|
|
289
280
|
position: 'absolute',
|
|
290
281
|
top: '0.5rem',
|
|
@@ -118,13 +118,6 @@ export var InlineAttachmentExtension = function InlineAttachmentExtension(props)
|
|
|
118
118
|
onError: props.onError,
|
|
119
119
|
attachmentType: 'icon'
|
|
120
120
|
}));
|
|
121
|
-
}, {
|
|
122
|
-
stopEvent: function stopEvent() {
|
|
123
|
-
return true;
|
|
124
|
-
},
|
|
125
|
-
ignoreMutation: function ignoreMutation() {
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
121
|
});
|
|
129
122
|
}
|
|
130
123
|
});
|
|
@@ -9,16 +9,6 @@ import { ReactNodeViewRenderer } from "@tiptap/react";
|
|
|
9
9
|
import ImageViewWrapper from "../component/Image";
|
|
10
10
|
var customImage = function customImage(props) {
|
|
11
11
|
return Image.extend({
|
|
12
|
-
atom: true,
|
|
13
|
-
inline: function inline() {
|
|
14
|
-
return true;
|
|
15
|
-
},
|
|
16
|
-
group: function group() {
|
|
17
|
-
return 'inline';
|
|
18
|
-
},
|
|
19
|
-
selectable: true,
|
|
20
|
-
draggable: true,
|
|
21
|
-
marks: '',
|
|
22
12
|
addKeyboardShortcuts: function addKeyboardShortcuts() {
|
|
23
13
|
var _this = this;
|
|
24
14
|
return {
|
|
@@ -36,13 +26,6 @@ var customImage = function customImage(props) {
|
|
|
36
26
|
onUpload: props.onUpload,
|
|
37
27
|
onError: props.onError
|
|
38
28
|
}));
|
|
39
|
-
}, {
|
|
40
|
-
stopEvent: function stopEvent() {
|
|
41
|
-
return true;
|
|
42
|
-
},
|
|
43
|
-
ignoreMutation: function ignoreMutation() {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
29
|
});
|
|
47
30
|
}
|
|
48
31
|
});
|