pxx-vue-quill 1.0.30 → 1.0.32

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-08-28T06:39:34.530Z
10
+ * Date: 2025-08-28T10:30:27.567Z
11
11
  */
12
12
  import { defineComponent, h, onMounted, onBeforeUnmount, ref, computed, watchEffect, watch, nextTick } from 'vue';
13
13
 
@@ -18778,11 +18778,11 @@ Object.defineProperty(DefaultAligner$1, "__esModule", {
18778
18778
  value: true
18779
18779
  });
18780
18780
 
18781
- 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; }; }();
18781
+ 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; }; }();
18782
18782
 
18783
18783
  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; }
18784
18784
 
18785
- function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18785
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18786
18786
 
18787
18787
  var LEFT_ALIGN = 'left';
18788
18788
  var CENTER_ALIGN = 'center';
@@ -18793,7 +18793,7 @@ var DefaultAligner = function () {
18793
18793
  var _this = this,
18794
18794
  _alignments;
18795
18795
 
18796
- _classCallCheck$1(this, DefaultAligner);
18796
+ _classCallCheck(this, DefaultAligner);
18797
18797
 
18798
18798
  this.applyStyle = options.aligner.applyStyle;
18799
18799
  this.alignAttribute = options.attribute;
@@ -18821,7 +18821,7 @@ var DefaultAligner = function () {
18821
18821
  }), _alignments);
18822
18822
  }
18823
18823
 
18824
- _createClass$1(DefaultAligner, [{
18824
+ _createClass(DefaultAligner, [{
18825
18825
  key: 'getAlignments',
18826
18826
  value: function getAlignments() {
18827
18827
  var _this2 = this;
@@ -19124,182 +19124,190 @@ function requireAlignAction () {
19124
19124
  return AlignAction;
19125
19125
  }
19126
19126
 
19127
- var ResizeAction$1 = {};
19127
+ var ResizeAction = {};
19128
19128
 
19129
- Object.defineProperty(ResizeAction$1, "__esModule", {
19130
- value: true
19131
- });
19129
+ var hasRequiredResizeAction;
19132
19130
 
19133
- 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; }; }();
19131
+ function requireResizeAction () {
19132
+ if (hasRequiredResizeAction) return ResizeAction;
19133
+ hasRequiredResizeAction = 1;
19134
19134
 
19135
- var _Action2 = requireAction();
19135
+ Object.defineProperty(ResizeAction, "__esModule", {
19136
+ value: true
19137
+ });
19136
19138
 
19137
- var _Action3 = _interopRequireDefault(_Action2);
19139
+ 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; }; }();
19138
19140
 
19139
- var _BlotFormatter = requireBlotFormatter();
19141
+ var _Action2 = requireAction();
19140
19142
 
19141
- _interopRequireDefault(_BlotFormatter);
19143
+ var _Action3 = _interopRequireDefault(_Action2);
19142
19144
 
19143
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19145
+ var _BlotFormatter = requireBlotFormatter();
19144
19146
 
19145
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19147
+ _interopRequireDefault(_BlotFormatter);
19146
19148
 
19147
- 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; }
19149
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19148
19150
 
19149
- 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; }
19151
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19150
19152
 
19151
- var ResizeAction = function (_Action) {
19152
- _inherits(ResizeAction, _Action);
19153
+ 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
19154
 
19154
- function ResizeAction(formatter) {
19155
- _classCallCheck(this, ResizeAction);
19155
+ 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; }
19156
19156
 
19157
- var _this = _possibleConstructorReturn(this, (ResizeAction.__proto__ || Object.getPrototypeOf(ResizeAction)).call(this, formatter));
19157
+ var ResizeAction$1 = function (_Action) {
19158
+ _inherits(ResizeAction, _Action);
19158
19159
 
19159
- _this.onMouseDown = function (event) {
19160
- if (!(event.target instanceof HTMLElement)) {
19161
- return;
19162
- }
19163
- _this.dragHandle = event.target;
19164
- _this.setCursor(_this.dragHandle.style.cursor);
19160
+ function ResizeAction(formatter) {
19161
+ _classCallCheck(this, ResizeAction);
19165
19162
 
19166
- if (!_this.formatter.currentSpec) {
19167
- return;
19168
- }
19163
+ var _this = _possibleConstructorReturn(this, (ResizeAction.__proto__ || Object.getPrototypeOf(ResizeAction)).call(this, formatter));
19169
19164
 
19170
- var target = _this.formatter.currentSpec.getTargetElement();
19171
- if (!target) {
19172
- return;
19173
- }
19165
+ _this.onMouseDown = function (event) {
19166
+ if (!(event.target instanceof HTMLElement)) {
19167
+ return;
19168
+ }
19169
+ _this.dragHandle = event.target;
19170
+ _this.setCursor(_this.dragHandle.style.cursor);
19174
19171
 
19175
- var rect = target.getBoundingClientRect();
19172
+ if (!_this.formatter.currentSpec) {
19173
+ return;
19174
+ }
19176
19175
 
19177
- _this.dragStartX = event.clientX;
19178
- _this.preDragWidth = rect.width;
19179
- _this.targetRatio = rect.height / rect.width;
19176
+ var target = _this.formatter.currentSpec.getTargetElement();
19177
+ if (!target) {
19178
+ return;
19179
+ }
19180
19180
 
19181
- document.addEventListener('mousemove', _this.onDrag);
19182
- document.addEventListener('mouseup', _this.onMouseUp);
19183
- };
19181
+ var rect = target.getBoundingClientRect();
19184
19182
 
19185
- _this.onDrag = function (event) {
19186
- if (!_this.formatter.currentSpec) {
19187
- return;
19188
- }
19183
+ _this.dragStartX = event.clientX;
19184
+ _this.preDragWidth = rect.width;
19185
+ _this.targetRatio = rect.height / rect.width;
19189
19186
 
19190
- var target = _this.formatter.currentSpec.getTargetElement();
19191
- if (!target) {
19192
- return;
19193
- }
19187
+ document.addEventListener('mousemove', _this.onDrag);
19188
+ document.addEventListener('mouseup', _this.onMouseUp);
19189
+ };
19194
19190
 
19195
- var deltaX = event.clientX - _this.dragStartX;
19196
- var newWidth = 0;
19191
+ _this.onDrag = function (event) {
19192
+ if (!_this.formatter.currentSpec) {
19193
+ return;
19194
+ }
19197
19195
 
19198
- if (_this.dragHandle === _this.topLeftHandle || _this.dragHandle === _this.bottomLeftHandle) {
19199
- newWidth = Math.round(_this.preDragWidth - deltaX);
19200
- } else {
19201
- newWidth = Math.round(_this.preDragWidth + deltaX);
19202
- }
19196
+ var target = _this.formatter.currentSpec.getTargetElement();
19197
+ if (!target) {
19198
+ return;
19199
+ }
19203
19200
 
19204
- var newHeight = _this.targetRatio * newWidth;
19201
+ var deltaX = event.clientX - _this.dragStartX;
19202
+ var newWidth = 0;
19205
19203
 
19206
- target.setAttribute('width', '' + newWidth);
19207
- target.setAttribute('height', '' + newHeight);
19204
+ if (_this.dragHandle === _this.topLeftHandle || _this.dragHandle === _this.bottomLeftHandle) {
19205
+ newWidth = Math.round(_this.preDragWidth - deltaX);
19206
+ } else {
19207
+ newWidth = Math.round(_this.preDragWidth + deltaX);
19208
+ }
19208
19209
 
19209
- _this.formatter.update();
19210
- };
19210
+ var newHeight = _this.targetRatio * newWidth;
19211
19211
 
19212
- _this.onMouseUp = function () {
19213
- _this.setCursor('');
19214
- document.removeEventListener('mousemove', _this.onDrag);
19215
- document.removeEventListener('mouseup', _this.onMouseUp);
19216
- };
19212
+ target.setAttribute('width', '' + newWidth);
19213
+ target.setAttribute('height', '' + newHeight);
19217
19214
 
19218
- _this.topLeftHandle = _this.createHandle('top-left', 'nwse-resize');
19219
- _this.topRightHandle = _this.createHandle('top-right', 'nesw-resize');
19220
- _this.bottomRightHandle = _this.createHandle('bottom-right', 'nwse-resize');
19221
- _this.bottomLeftHandle = _this.createHandle('bottom-left', 'nesw-resize');
19222
- _this.dragHandle = null;
19223
- _this.dragStartX = 0;
19224
- _this.preDragWidth = 0;
19225
- _this.targetRatio = 0;
19226
- return _this;
19227
- }
19215
+ _this.formatter.update();
19216
+ };
19228
19217
 
19229
- _createClass(ResizeAction, [{
19230
- key: 'onCreate',
19231
- value: function onCreate() {
19232
- this.formatter.overlay.appendChild(this.topLeftHandle);
19233
- this.formatter.overlay.appendChild(this.topRightHandle);
19234
- this.formatter.overlay.appendChild(this.bottomRightHandle);
19235
- this.formatter.overlay.appendChild(this.bottomLeftHandle);
19218
+ _this.onMouseUp = function () {
19219
+ _this.setCursor('');
19220
+ document.removeEventListener('mousemove', _this.onDrag);
19221
+ document.removeEventListener('mouseup', _this.onMouseUp);
19222
+ };
19236
19223
 
19237
- this.repositionHandles(this.formatter.options.resize.handleStyle);
19238
- }
19239
- }, {
19240
- key: 'onDestroy',
19241
- value: function onDestroy() {
19242
- this.setCursor('');
19243
- this.formatter.overlay.removeChild(this.topLeftHandle);
19244
- this.formatter.overlay.removeChild(this.topRightHandle);
19245
- this.formatter.overlay.removeChild(this.bottomRightHandle);
19246
- this.formatter.overlay.removeChild(this.bottomLeftHandle);
19247
- }
19248
- }, {
19249
- key: 'createHandle',
19250
- value: function createHandle(position, cursor) {
19251
- var box = document.createElement('div');
19252
- box.classList.add(this.formatter.options.resize.handleClassName);
19253
- box.setAttribute('data-position', position);
19254
- box.style.cursor = cursor;
19255
-
19256
- if (this.formatter.options.resize.handleStyle) {
19257
- Object.assign(box.style, this.formatter.options.resize.handleStyle);
19258
- }
19224
+ _this.topLeftHandle = _this.createHandle('top-left', 'nwse-resize');
19225
+ _this.topRightHandle = _this.createHandle('top-right', 'nesw-resize');
19226
+ _this.bottomRightHandle = _this.createHandle('bottom-right', 'nwse-resize');
19227
+ _this.bottomLeftHandle = _this.createHandle('bottom-left', 'nesw-resize');
19228
+ _this.dragHandle = null;
19229
+ _this.dragStartX = 0;
19230
+ _this.preDragWidth = 0;
19231
+ _this.targetRatio = 0;
19232
+ return _this;
19233
+ }
19259
19234
 
19260
- box.addEventListener('mousedown', this.onMouseDown);
19235
+ _createClass(ResizeAction, [{
19236
+ key: 'onCreate',
19237
+ value: function onCreate() {
19238
+ this.formatter.overlay.appendChild(this.topLeftHandle);
19239
+ this.formatter.overlay.appendChild(this.topRightHandle);
19240
+ this.formatter.overlay.appendChild(this.bottomRightHandle);
19241
+ this.formatter.overlay.appendChild(this.bottomLeftHandle);
19261
19242
 
19262
- return box;
19263
- }
19264
- }, {
19265
- key: 'repositionHandles',
19266
- value: function repositionHandles(handleStyle) {
19267
- var handleXOffset = '0px';
19268
- var handleYOffset = '0px';
19269
- if (handleStyle) {
19270
- if (handleStyle.width) {
19271
- handleXOffset = -parseFloat(handleStyle.width) / 2 + 'px';
19272
- }
19273
- if (handleStyle.height) {
19274
- handleYOffset = -parseFloat(handleStyle.height) / 2 + 'px';
19275
- }
19276
- }
19243
+ this.repositionHandles(this.formatter.options.resize.handleStyle);
19244
+ }
19245
+ }, {
19246
+ key: 'onDestroy',
19247
+ value: function onDestroy() {
19248
+ this.setCursor('');
19249
+ this.formatter.overlay.removeChild(this.topLeftHandle);
19250
+ this.formatter.overlay.removeChild(this.topRightHandle);
19251
+ this.formatter.overlay.removeChild(this.bottomRightHandle);
19252
+ this.formatter.overlay.removeChild(this.bottomLeftHandle);
19253
+ }
19254
+ }, {
19255
+ key: 'createHandle',
19256
+ value: function createHandle(position, cursor) {
19257
+ var box = document.createElement('div');
19258
+ box.classList.add(this.formatter.options.resize.handleClassName);
19259
+ box.setAttribute('data-position', position);
19260
+ box.style.cursor = cursor;
19261
+
19262
+ if (this.formatter.options.resize.handleStyle) {
19263
+ Object.assign(box.style, this.formatter.options.resize.handleStyle);
19264
+ }
19277
19265
 
19278
- Object.assign(this.topLeftHandle.style, { left: handleXOffset, top: handleYOffset });
19279
- Object.assign(this.topRightHandle.style, { right: handleXOffset, top: handleYOffset });
19280
- Object.assign(this.bottomRightHandle.style, { right: handleXOffset, bottom: handleYOffset });
19281
- Object.assign(this.bottomLeftHandle.style, { left: handleXOffset, bottom: handleYOffset });
19282
- }
19283
- }, {
19284
- key: 'setCursor',
19285
- value: function setCursor(value) {
19286
- if (document.body) {
19287
- document.body.style.cursor = value;
19288
- }
19266
+ box.addEventListener('mousedown', this.onMouseDown);
19289
19267
 
19290
- if (this.formatter.currentSpec) {
19291
- var target = this.formatter.currentSpec.getOverlayElement();
19292
- if (target) {
19293
- target.style.cursor = value;
19294
- }
19295
- }
19296
- }
19297
- }]);
19268
+ return box;
19269
+ }
19270
+ }, {
19271
+ key: 'repositionHandles',
19272
+ value: function repositionHandles(handleStyle) {
19273
+ var handleXOffset = '0px';
19274
+ var handleYOffset = '0px';
19275
+ if (handleStyle) {
19276
+ if (handleStyle.width) {
19277
+ handleXOffset = -parseFloat(handleStyle.width) / 2 + 'px';
19278
+ }
19279
+ if (handleStyle.height) {
19280
+ handleYOffset = -parseFloat(handleStyle.height) / 2 + 'px';
19281
+ }
19282
+ }
19298
19283
 
19299
- return ResizeAction;
19300
- }(_Action3.default);
19284
+ Object.assign(this.topLeftHandle.style, { left: handleXOffset, top: handleYOffset });
19285
+ Object.assign(this.topRightHandle.style, { right: handleXOffset, top: handleYOffset });
19286
+ Object.assign(this.bottomRightHandle.style, { right: handleXOffset, bottom: handleYOffset });
19287
+ Object.assign(this.bottomLeftHandle.style, { left: handleXOffset, bottom: handleYOffset });
19288
+ }
19289
+ }, {
19290
+ key: 'setCursor',
19291
+ value: function setCursor(value) {
19292
+ if (document.body) {
19293
+ document.body.style.cursor = value;
19294
+ }
19301
19295
 
19302
- ResizeAction$1.default = ResizeAction;
19296
+ if (this.formatter.currentSpec) {
19297
+ var target = this.formatter.currentSpec.getOverlayElement();
19298
+ if (target) {
19299
+ target.style.cursor = value;
19300
+ }
19301
+ }
19302
+ }
19303
+ }]);
19304
+
19305
+ return ResizeAction;
19306
+ }(_Action3.default);
19307
+
19308
+ ResizeAction.default = ResizeAction$1;
19309
+ return ResizeAction;
19310
+ }
19303
19311
 
19304
19312
  var DeleteAction = {};
19305
19313
 
@@ -19406,7 +19414,7 @@ function requireBlotSpec () {
19406
19414
 
19407
19415
  var _AlignAction2 = _interopRequireDefault(_AlignAction);
19408
19416
 
19409
- var _ResizeAction = ResizeAction$1;
19417
+ var _ResizeAction = requireResizeAction();
19410
19418
 
19411
19419
  var _ResizeAction2 = _interopRequireDefault(_ResizeAction);
19412
19420
 
@@ -19899,7 +19907,7 @@ function requireOptions () {
19899
19907
  }
19900
19908
  });
19901
19909
 
19902
- var _ResizeAction = ResizeAction$1;
19910
+ var _ResizeAction = requireResizeAction();
19903
19911
 
19904
19912
  Object.defineProperty(exports, 'ResizeAction', {
19905
19913
  enumerable: true,
@@ -20444,6 +20452,13 @@ const QuillEditor = defineComponent({
20444
20452
  };
20445
20453
  const handleTextChange = (delta, oldContents, source) => {
20446
20454
  internalModel = maybeClone(getContents());
20455
+ // 因为默认是<p><br></p>,影响element-ui的表单验证,所以默认设为空,有值才显示<p>内容</p>
20456
+ if (props.contentType === 'html') {
20457
+ const html = getHTML();
20458
+ if (html === '' || html === '<p><br></p>' || html === '<p></p>') {
20459
+ internalModel = '';
20460
+ }
20461
+ }
20447
20462
  if (!internalModelEquals(props.content)) {
20448
20463
  ctx.emit('update:content', internalModel);
20449
20464
  }
@@ -20519,7 +20534,15 @@ const QuillEditor = defineComponent({
20519
20534
  : ''
20520
20535
  : content;
20521
20536
  if (props.contentType === 'html') {
20522
- setHTML(normalizedContent);
20537
+ // 对于空内容,直接清空编辑器,不插入默认结构
20538
+ if (!normalizedContent || normalizedContent === '') {
20539
+ if (quill) {
20540
+ quill.root.innerHTML = '';
20541
+ }
20542
+ }
20543
+ else {
20544
+ setHTML(normalizedContent);
20545
+ }
20523
20546
  }
20524
20547
  else if (props.contentType === 'text') {
20525
20548
  setText(normalizedContent, source);
@@ -20538,7 +20561,12 @@ const QuillEditor = defineComponent({
20538
20561
  };
20539
20562
  const getHTML = () => {
20540
20563
  var _a;
20541
- return (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
20564
+ const html = (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
20565
+ // 如果内容是默认的空段落结构,返回空字符串
20566
+ if (html === '<p><br></p>' || html === '<p></p>') {
20567
+ return '';
20568
+ }
20569
+ return html;
20542
20570
  };
20543
20571
  const setHTML = (html) => {
20544
20572
  if (quill)