pxx-vue-quill 1.0.54 → 1.0.56

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,7 +7,7 @@
7
7
  *
8
8
  * Copyright (c) 2025 Pxx-Team
9
9
  * Released under the MIT license
10
- * Date: 2025-09-02T08:02:24.939Z
10
+ * Date: 2025-09-02T08:21:13.732Z
11
11
  */
12
12
  (function (global, factory) {
13
13
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
@@ -18781,11 +18781,11 @@
18781
18781
  value: true
18782
18782
  });
18783
18783
 
18784
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
18784
+ var _createClass$1 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
18785
18785
 
18786
18786
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
18787
18787
 
18788
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18788
+ function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18789
18789
 
18790
18790
  var LEFT_ALIGN = 'left';
18791
18791
  var CENTER_ALIGN = 'center';
@@ -18796,7 +18796,7 @@
18796
18796
  var _this = this,
18797
18797
  _alignments;
18798
18798
 
18799
- _classCallCheck(this, DefaultAligner);
18799
+ _classCallCheck$1(this, DefaultAligner);
18800
18800
 
18801
18801
  this.applyStyle = options.aligner.applyStyle;
18802
18802
  this.alignAttribute = options.attribute;
@@ -18824,7 +18824,7 @@
18824
18824
  }), _alignments);
18825
18825
  }
18826
18826
 
18827
- _createClass(DefaultAligner, [{
18827
+ _createClass$1(DefaultAligner, [{
18828
18828
  key: 'getAlignments',
18829
18829
  value: function getAlignments() {
18830
18830
  var _this2 = this;
@@ -19127,190 +19127,182 @@
19127
19127
  return AlignAction;
19128
19128
  }
19129
19129
 
19130
- var ResizeAction = {};
19130
+ var ResizeAction$1 = {};
19131
19131
 
19132
- var hasRequiredResizeAction;
19132
+ Object.defineProperty(ResizeAction$1, "__esModule", {
19133
+ value: true
19134
+ });
19133
19135
 
19134
- function requireResizeAction () {
19135
- if (hasRequiredResizeAction) return ResizeAction;
19136
- hasRequiredResizeAction = 1;
19136
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
19137
19137
 
19138
- Object.defineProperty(ResizeAction, "__esModule", {
19139
- value: true
19140
- });
19138
+ var _Action2 = requireAction();
19141
19139
 
19142
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
19140
+ var _Action3 = _interopRequireDefault(_Action2);
19143
19141
 
19144
- var _Action2 = requireAction();
19142
+ var _BlotFormatter = requireBlotFormatter();
19145
19143
 
19146
- var _Action3 = _interopRequireDefault(_Action2);
19144
+ _interopRequireDefault(_BlotFormatter);
19147
19145
 
19148
- var _BlotFormatter = requireBlotFormatter();
19146
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19149
19147
 
19150
- _interopRequireDefault(_BlotFormatter);
19148
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19151
19149
 
19152
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19150
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
19153
19151
 
19154
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19152
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
19155
19153
 
19156
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
19154
+ var ResizeAction = function (_Action) {
19155
+ _inherits(ResizeAction, _Action);
19157
19156
 
19158
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
19157
+ function ResizeAction(formatter) {
19158
+ _classCallCheck(this, ResizeAction);
19159
19159
 
19160
- var ResizeAction$1 = function (_Action) {
19161
- _inherits(ResizeAction, _Action);
19160
+ var _this = _possibleConstructorReturn(this, (ResizeAction.__proto__ || Object.getPrototypeOf(ResizeAction)).call(this, formatter));
19162
19161
 
19163
- function ResizeAction(formatter) {
19164
- _classCallCheck(this, ResizeAction);
19162
+ _this.onMouseDown = function (event) {
19163
+ if (!(event.target instanceof HTMLElement)) {
19164
+ return;
19165
+ }
19166
+ _this.dragHandle = event.target;
19167
+ _this.setCursor(_this.dragHandle.style.cursor);
19165
19168
 
19166
- var _this = _possibleConstructorReturn(this, (ResizeAction.__proto__ || Object.getPrototypeOf(ResizeAction)).call(this, formatter));
19169
+ if (!_this.formatter.currentSpec) {
19170
+ return;
19171
+ }
19167
19172
 
19168
- _this.onMouseDown = function (event) {
19169
- if (!(event.target instanceof HTMLElement)) {
19170
- return;
19171
- }
19172
- _this.dragHandle = event.target;
19173
- _this.setCursor(_this.dragHandle.style.cursor);
19173
+ var target = _this.formatter.currentSpec.getTargetElement();
19174
+ if (!target) {
19175
+ return;
19176
+ }
19174
19177
 
19175
- if (!_this.formatter.currentSpec) {
19176
- return;
19177
- }
19178
+ var rect = target.getBoundingClientRect();
19178
19179
 
19179
- var target = _this.formatter.currentSpec.getTargetElement();
19180
- if (!target) {
19181
- return;
19182
- }
19180
+ _this.dragStartX = event.clientX;
19181
+ _this.preDragWidth = rect.width;
19182
+ _this.targetRatio = rect.height / rect.width;
19183
19183
 
19184
- var rect = target.getBoundingClientRect();
19185
-
19186
- _this.dragStartX = event.clientX;
19187
- _this.preDragWidth = rect.width;
19188
- _this.targetRatio = rect.height / rect.width;
19184
+ document.addEventListener('mousemove', _this.onDrag);
19185
+ document.addEventListener('mouseup', _this.onMouseUp);
19186
+ };
19189
19187
 
19190
- document.addEventListener('mousemove', _this.onDrag);
19191
- document.addEventListener('mouseup', _this.onMouseUp);
19192
- };
19188
+ _this.onDrag = function (event) {
19189
+ if (!_this.formatter.currentSpec) {
19190
+ return;
19191
+ }
19193
19192
 
19194
- _this.onDrag = function (event) {
19195
- if (!_this.formatter.currentSpec) {
19196
- return;
19197
- }
19193
+ var target = _this.formatter.currentSpec.getTargetElement();
19194
+ if (!target) {
19195
+ return;
19196
+ }
19198
19197
 
19199
- var target = _this.formatter.currentSpec.getTargetElement();
19200
- if (!target) {
19201
- return;
19202
- }
19198
+ var deltaX = event.clientX - _this.dragStartX;
19199
+ var newWidth = 0;
19203
19200
 
19204
- var deltaX = event.clientX - _this.dragStartX;
19205
- var newWidth = 0;
19201
+ if (_this.dragHandle === _this.topLeftHandle || _this.dragHandle === _this.bottomLeftHandle) {
19202
+ newWidth = Math.round(_this.preDragWidth - deltaX);
19203
+ } else {
19204
+ newWidth = Math.round(_this.preDragWidth + deltaX);
19205
+ }
19206
19206
 
19207
- if (_this.dragHandle === _this.topLeftHandle || _this.dragHandle === _this.bottomLeftHandle) {
19208
- newWidth = Math.round(_this.preDragWidth - deltaX);
19209
- } else {
19210
- newWidth = Math.round(_this.preDragWidth + deltaX);
19211
- }
19207
+ var newHeight = _this.targetRatio * newWidth;
19212
19208
 
19213
- var newHeight = _this.targetRatio * newWidth;
19209
+ target.setAttribute('width', '' + newWidth);
19210
+ target.setAttribute('height', '' + newHeight);
19214
19211
 
19215
- target.setAttribute('width', '' + newWidth);
19216
- target.setAttribute('height', '' + newHeight);
19212
+ _this.formatter.update();
19213
+ };
19217
19214
 
19218
- _this.formatter.update();
19219
- };
19215
+ _this.onMouseUp = function () {
19216
+ _this.setCursor('');
19217
+ document.removeEventListener('mousemove', _this.onDrag);
19218
+ document.removeEventListener('mouseup', _this.onMouseUp);
19219
+ };
19220
19220
 
19221
- _this.onMouseUp = function () {
19222
- _this.setCursor('');
19223
- document.removeEventListener('mousemove', _this.onDrag);
19224
- document.removeEventListener('mouseup', _this.onMouseUp);
19225
- };
19221
+ _this.topLeftHandle = _this.createHandle('top-left', 'nwse-resize');
19222
+ _this.topRightHandle = _this.createHandle('top-right', 'nesw-resize');
19223
+ _this.bottomRightHandle = _this.createHandle('bottom-right', 'nwse-resize');
19224
+ _this.bottomLeftHandle = _this.createHandle('bottom-left', 'nesw-resize');
19225
+ _this.dragHandle = null;
19226
+ _this.dragStartX = 0;
19227
+ _this.preDragWidth = 0;
19228
+ _this.targetRatio = 0;
19229
+ return _this;
19230
+ }
19226
19231
 
19227
- _this.topLeftHandle = _this.createHandle('top-left', 'nwse-resize');
19228
- _this.topRightHandle = _this.createHandle('top-right', 'nesw-resize');
19229
- _this.bottomRightHandle = _this.createHandle('bottom-right', 'nwse-resize');
19230
- _this.bottomLeftHandle = _this.createHandle('bottom-left', 'nesw-resize');
19231
- _this.dragHandle = null;
19232
- _this.dragStartX = 0;
19233
- _this.preDragWidth = 0;
19234
- _this.targetRatio = 0;
19235
- return _this;
19236
- }
19232
+ _createClass(ResizeAction, [{
19233
+ key: 'onCreate',
19234
+ value: function onCreate() {
19235
+ this.formatter.overlay.appendChild(this.topLeftHandle);
19236
+ this.formatter.overlay.appendChild(this.topRightHandle);
19237
+ this.formatter.overlay.appendChild(this.bottomRightHandle);
19238
+ this.formatter.overlay.appendChild(this.bottomLeftHandle);
19237
19239
 
19238
- _createClass(ResizeAction, [{
19239
- key: 'onCreate',
19240
- value: function onCreate() {
19241
- this.formatter.overlay.appendChild(this.topLeftHandle);
19242
- this.formatter.overlay.appendChild(this.topRightHandle);
19243
- this.formatter.overlay.appendChild(this.bottomRightHandle);
19244
- this.formatter.overlay.appendChild(this.bottomLeftHandle);
19245
-
19246
- this.repositionHandles(this.formatter.options.resize.handleStyle);
19247
- }
19248
- }, {
19249
- key: 'onDestroy',
19250
- value: function onDestroy() {
19251
- this.setCursor('');
19252
- this.formatter.overlay.removeChild(this.topLeftHandle);
19253
- this.formatter.overlay.removeChild(this.topRightHandle);
19254
- this.formatter.overlay.removeChild(this.bottomRightHandle);
19255
- this.formatter.overlay.removeChild(this.bottomLeftHandle);
19256
- }
19257
- }, {
19258
- key: 'createHandle',
19259
- value: function createHandle(position, cursor) {
19260
- var box = document.createElement('div');
19261
- box.classList.add(this.formatter.options.resize.handleClassName);
19262
- box.setAttribute('data-position', position);
19263
- box.style.cursor = cursor;
19264
-
19265
- if (this.formatter.options.resize.handleStyle) {
19266
- Object.assign(box.style, this.formatter.options.resize.handleStyle);
19267
- }
19240
+ this.repositionHandles(this.formatter.options.resize.handleStyle);
19241
+ }
19242
+ }, {
19243
+ key: 'onDestroy',
19244
+ value: function onDestroy() {
19245
+ this.setCursor('');
19246
+ this.formatter.overlay.removeChild(this.topLeftHandle);
19247
+ this.formatter.overlay.removeChild(this.topRightHandle);
19248
+ this.formatter.overlay.removeChild(this.bottomRightHandle);
19249
+ this.formatter.overlay.removeChild(this.bottomLeftHandle);
19250
+ }
19251
+ }, {
19252
+ key: 'createHandle',
19253
+ value: function createHandle(position, cursor) {
19254
+ var box = document.createElement('div');
19255
+ box.classList.add(this.formatter.options.resize.handleClassName);
19256
+ box.setAttribute('data-position', position);
19257
+ box.style.cursor = cursor;
19258
+
19259
+ if (this.formatter.options.resize.handleStyle) {
19260
+ Object.assign(box.style, this.formatter.options.resize.handleStyle);
19261
+ }
19268
19262
 
19269
- box.addEventListener('mousedown', this.onMouseDown);
19263
+ box.addEventListener('mousedown', this.onMouseDown);
19270
19264
 
19271
- return box;
19272
- }
19273
- }, {
19274
- key: 'repositionHandles',
19275
- value: function repositionHandles(handleStyle) {
19276
- var handleXOffset = '0px';
19277
- var handleYOffset = '0px';
19278
- if (handleStyle) {
19279
- if (handleStyle.width) {
19280
- handleXOffset = -parseFloat(handleStyle.width) / 2 + 'px';
19281
- }
19282
- if (handleStyle.height) {
19283
- handleYOffset = -parseFloat(handleStyle.height) / 2 + 'px';
19284
- }
19285
- }
19265
+ return box;
19266
+ }
19267
+ }, {
19268
+ key: 'repositionHandles',
19269
+ value: function repositionHandles(handleStyle) {
19270
+ var handleXOffset = '0px';
19271
+ var handleYOffset = '0px';
19272
+ if (handleStyle) {
19273
+ if (handleStyle.width) {
19274
+ handleXOffset = -parseFloat(handleStyle.width) / 2 + 'px';
19275
+ }
19276
+ if (handleStyle.height) {
19277
+ handleYOffset = -parseFloat(handleStyle.height) / 2 + 'px';
19278
+ }
19279
+ }
19286
19280
 
19287
- Object.assign(this.topLeftHandle.style, { left: handleXOffset, top: handleYOffset });
19288
- Object.assign(this.topRightHandle.style, { right: handleXOffset, top: handleYOffset });
19289
- Object.assign(this.bottomRightHandle.style, { right: handleXOffset, bottom: handleYOffset });
19290
- Object.assign(this.bottomLeftHandle.style, { left: handleXOffset, bottom: handleYOffset });
19291
- }
19292
- }, {
19293
- key: 'setCursor',
19294
- value: function setCursor(value) {
19295
- if (document.body) {
19296
- document.body.style.cursor = value;
19297
- }
19281
+ Object.assign(this.topLeftHandle.style, { left: handleXOffset, top: handleYOffset });
19282
+ Object.assign(this.topRightHandle.style, { right: handleXOffset, top: handleYOffset });
19283
+ Object.assign(this.bottomRightHandle.style, { right: handleXOffset, bottom: handleYOffset });
19284
+ Object.assign(this.bottomLeftHandle.style, { left: handleXOffset, bottom: handleYOffset });
19285
+ }
19286
+ }, {
19287
+ key: 'setCursor',
19288
+ value: function setCursor(value) {
19289
+ if (document.body) {
19290
+ document.body.style.cursor = value;
19291
+ }
19298
19292
 
19299
- if (this.formatter.currentSpec) {
19300
- var target = this.formatter.currentSpec.getOverlayElement();
19301
- if (target) {
19302
- target.style.cursor = value;
19303
- }
19304
- }
19305
- }
19306
- }]);
19293
+ if (this.formatter.currentSpec) {
19294
+ var target = this.formatter.currentSpec.getOverlayElement();
19295
+ if (target) {
19296
+ target.style.cursor = value;
19297
+ }
19298
+ }
19299
+ }
19300
+ }]);
19307
19301
 
19308
- return ResizeAction;
19309
- }(_Action3.default);
19302
+ return ResizeAction;
19303
+ }(_Action3.default);
19310
19304
 
19311
- ResizeAction.default = ResizeAction$1;
19312
- return ResizeAction;
19313
- }
19305
+ ResizeAction$1.default = ResizeAction;
19314
19306
 
19315
19307
  var DeleteAction = {};
19316
19308
 
@@ -19417,7 +19409,7 @@
19417
19409
 
19418
19410
  var _AlignAction2 = _interopRequireDefault(_AlignAction);
19419
19411
 
19420
- var _ResizeAction = requireResizeAction();
19412
+ var _ResizeAction = ResizeAction$1;
19421
19413
 
19422
19414
  var _ResizeAction2 = _interopRequireDefault(_ResizeAction);
19423
19415
 
@@ -19910,7 +19902,7 @@
19910
19902
  }
19911
19903
  });
19912
19904
 
19913
- var _ResizeAction = requireResizeAction();
19905
+ var _ResizeAction = ResizeAction$1;
19914
19906
 
19915
19907
  Object.defineProperty(exports, 'ResizeAction', {
19916
19908
  enumerable: true,
@@ -20183,13 +20175,32 @@
20183
20175
  setup: (props, ctx) => {
20184
20176
  vue.onMounted(() => {
20185
20177
  initialize();
20178
+ document.addEventListener('click', handleGlobalClick);
20186
20179
  });
20187
20180
  const removeQuillBlotFormatter = () => {
20188
- const overlay = quill === null || quill === void 0 ? void 0 : quill.getModule('blotFormatter').overlay;
20189
- if (overlay)
20190
- overlay.remove();
20181
+ try {
20182
+ const blotFormatter = quill === null || quill === void 0 ? void 0 : quill.getModule('blotFormatter');
20183
+ if (blotFormatter && blotFormatter.overlay) {
20184
+ const overlay = blotFormatter.overlay;
20185
+ if (overlay.parentNode) {
20186
+ overlay.parentNode.removeChild(overlay);
20187
+ }
20188
+ }
20189
+ }
20190
+ catch (error) {
20191
+ console.warn('移除blotFormatter overlay时出错:', error);
20192
+ }
20193
+ };
20194
+ const handleGlobalClick = (event) => {
20195
+ if (!editor.value)
20196
+ return;
20197
+ const isClickInsideEditor = editor.value.contains(event.target);
20198
+ if (!isClickInsideEditor) {
20199
+ removeQuillBlotFormatter();
20200
+ }
20191
20201
  };
20192
20202
  vue.onBeforeUnmount(() => {
20203
+ document.removeEventListener('click', handleGlobalClick);
20193
20204
  removeQuillBlotFormatter();
20194
20205
  quill = null;
20195
20206
  });
@@ -20392,7 +20403,6 @@
20392
20403
  ctx.emit('blur', editor);
20393
20404
  });
20394
20405
  const handleEditorChange = (...args) => {
20395
- removeQuillBlotFormatter();
20396
20406
  if (args[0] === 'text-change')
20397
20407
  ctx.emit('editorChange', {
20398
20408
  name: args[0],
@@ -20540,7 +20550,7 @@
20540
20550
  reinit,
20541
20551
  editorWrapClass,
20542
20552
  showMoreToolbar,
20543
- moreToolbarToolClick,
20553
+ moreToolbarToolClick
20544
20554
  };
20545
20555
  },
20546
20556
  render() {