@ctzhian/tiptap 1.6.15 → 1.6.16

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.
@@ -7,11 +7,9 @@ import 'react-photo-view/dist/react-photo-view.css';
7
7
  var ReadonlyImage = function ReadonlyImage(_ref) {
8
8
  var attrs = _ref.attrs;
9
9
  return /*#__PURE__*/React.createElement(NodeViewWrapper, {
10
- className: "image-wrapper",
11
- contentEditable: false
10
+ className: "image-wrapper"
12
11
  }, /*#__PURE__*/React.createElement(Box, {
13
12
  component: 'span',
14
- contentEditable: false,
15
13
  sx: {
16
14
  position: 'relative',
17
15
  display: 'inline-block',
@@ -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
- if (rafRef.current) return;
156
- rafRef.current = requestAnimationFrame(function () {
157
- rafRef.current = null;
158
- var deltaX = e.clientX - dragStartX;
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,8 +177,8 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
182
177
  var currentWidth = getCurrentDisplayWidth();
183
178
  updateAttributes({
184
179
  src: editSrc.trim(),
185
- width: currentWidth
186
- // error: true,
180
+ width: currentWidth,
181
+ error: true
187
182
  });
188
183
  setEditSrc(editSrc.trim());
189
184
  }
@@ -199,11 +194,6 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
199
194
  };
200
195
  }
201
196
  }, [isDragging]);
202
- useEffect(function () {
203
- return function () {
204
- if (rafRef.current) cancelAnimationFrame(rafRef.current);
205
- };
206
- }, []);
207
197
  if (!attrs.src && !editor.isEditable) {
208
198
  return null;
209
199
  }
@@ -233,11 +223,9 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
233
223
  return /*#__PURE__*/React.createElement(NodeViewWrapper, {
234
224
  className: "image-wrapper ".concat(selected ? 'ProseMirror-selectednode' : ''),
235
225
  as: 'span',
236
- contentEditable: false,
237
226
  'data-drag-handle': false
238
227
  }, /*#__PURE__*/React.createElement(Box, {
239
228
  component: 'span',
240
- contentEditable: false,
241
229
  sx: {
242
230
  position: 'relative',
243
231
  display: 'inline-block',
@@ -269,7 +257,6 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
269
257
  _onError === null || _onError === void 0 || _onError(e);
270
258
  }
271
259
  }), (isHovering || isDragging) && /*#__PURE__*/React.createElement(Box, {
272
- contentEditable: false,
273
260
  onMouseDown: handleMouseDown,
274
261
  sx: {
275
262
  position: 'absolute',
@@ -288,7 +275,6 @@ var ImageViewWrapper = function ImageViewWrapper(_ref) {
288
275
  zIndex: 10
289
276
  }
290
277
  }), (isHovering || !!anchorEl) && /*#__PURE__*/React.createElement(Box, {
291
- contentEditable: false,
292
278
  className: "image-controls",
293
279
  sx: {
294
280
  position: 'absolute',
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  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); }
7
7
  import { NestedList } from "../../../component";
8
- import { ArrowDownSLineIcon, AttachmentLineIcon, CheckboxCircleFillIcon, CloseCircleFillIcon, ErrorWarningFillIcon, FormulaIcon, FunctionsIcon, ImageLineIcon, Information2FillIcon, Information2LineIcon, MovieLineIcon, Music2LineIcon, SquareRootIcon, Table2Icon, UploadIcon } from "../../../component/Icons";
8
+ import { ArrowDownSLineIcon, AttachmentLineIcon, CheckboxCircleFillIcon, CloseCircleFillIcon, ErrorWarningFillIcon, FormulaIcon, FunctionsIcon, ImageLineIcon, Information2FillIcon, Information2LineIcon, MovieLineIcon, Music2LineIcon, SquareRootIcon, Table2Icon, UploadIcon, UserSmileFillIcon } from "../../../component/Icons";
9
9
  import { ToolbarItem } from "../../../component/Toolbar";
10
10
  import TableSizePicker from "../../../component/Toolbar/TableSizePicker";
11
11
  import { getShortcutKeyText } from "../../../util";
@@ -158,6 +158,26 @@ var SlashCommandsList = /*#__PURE__*/forwardRef(function (_ref, ref) {
158
158
  }
159
159
  }));
160
160
  }
161
+ }, {
162
+ label: '默认 Default',
163
+ key: 'default',
164
+ icon: /*#__PURE__*/React.createElement(UserSmileFillIcon, {
165
+ sx: {
166
+ fontSize: '1rem',
167
+ color: 'text.disabled'
168
+ }
169
+ }),
170
+ onClick: function onClick() {
171
+ var node = items.find(function (it) {
172
+ return it.title === '警告提示';
173
+ });
174
+ if (node) command(_objectSpread(_objectSpread({}, node), {}, {
175
+ attrs: {
176
+ type: 'icon',
177
+ variant: 'default'
178
+ }
179
+ }));
180
+ }
161
181
  }]
162
182
  }, {
163
183
  label: '数学公式',
@@ -26,15 +26,6 @@ var customImage = function customImage(props) {
26
26
  onUpload: props.onUpload,
27
27
  onError: props.onError
28
28
  }));
29
- }, {
30
- stopEvent: function stopEvent(e) {
31
- var el = e.event.target;
32
- // Swallow events from resizer & controls (safe option: return true for all)
33
- if (el.closest('.image-resizer') || el.closest('.image-controls') || el.closest('.image-wrapper')) {
34
- return true;
35
- }
36
- return false;
37
- }
38
29
  });
39
30
  }
40
31
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzhian/tiptap",
3
- "version": "1.6.15",
3
+ "version": "1.6.16",
4
4
  "description": "基于 Tiptap 二次开发的编辑器组件",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",