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
  (function (global, factory) {
13
13
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
@@ -18782,11 +18782,11 @@
18782
18782
  value: true
18783
18783
  });
18784
18784
 
18785
- 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
+ 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; }; }();
18786
18786
 
18787
18787
  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; }
18788
18788
 
18789
- function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18789
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18790
18790
 
18791
18791
  var LEFT_ALIGN = 'left';
18792
18792
  var CENTER_ALIGN = 'center';
@@ -18797,7 +18797,7 @@
18797
18797
  var _this = this,
18798
18798
  _alignments;
18799
18799
 
18800
- _classCallCheck$1(this, DefaultAligner);
18800
+ _classCallCheck(this, DefaultAligner);
18801
18801
 
18802
18802
  this.applyStyle = options.aligner.applyStyle;
18803
18803
  this.alignAttribute = options.attribute;
@@ -18825,7 +18825,7 @@
18825
18825
  }), _alignments);
18826
18826
  }
18827
18827
 
18828
- _createClass$1(DefaultAligner, [{
18828
+ _createClass(DefaultAligner, [{
18829
18829
  key: 'getAlignments',
18830
18830
  value: function getAlignments() {
18831
18831
  var _this2 = this;
@@ -19550,148 +19550,156 @@
19550
19550
 
19551
19551
  var IframeVideoSpec = {};
19552
19552
 
19553
- var UnclickableBlotSpec$1 = {};
19553
+ var UnclickableBlotSpec = {};
19554
19554
 
19555
- Object.defineProperty(UnclickableBlotSpec$1, "__esModule", {
19556
- value: true
19557
- });
19555
+ var hasRequiredUnclickableBlotSpec;
19558
19556
 
19559
- 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; }; }();
19557
+ function requireUnclickableBlotSpec () {
19558
+ if (hasRequiredUnclickableBlotSpec) return UnclickableBlotSpec;
19559
+ hasRequiredUnclickableBlotSpec = 1;
19560
19560
 
19561
- var _BlotSpec2 = requireBlotSpec();
19561
+ Object.defineProperty(UnclickableBlotSpec, "__esModule", {
19562
+ value: true
19563
+ });
19562
19564
 
19563
- var _BlotSpec3 = _interopRequireDefault(_BlotSpec2);
19565
+ 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; }; }();
19564
19566
 
19565
- var _BlotFormatter = requireBlotFormatter();
19567
+ var _BlotSpec2 = requireBlotSpec();
19566
19568
 
19567
- _interopRequireDefault(_BlotFormatter);
19569
+ var _BlotSpec3 = _interopRequireDefault(_BlotSpec2);
19568
19570
 
19569
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19571
+ var _BlotFormatter = requireBlotFormatter();
19570
19572
 
19571
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19573
+ _interopRequireDefault(_BlotFormatter);
19572
19574
 
19573
- 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; }
19575
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19574
19576
 
19575
- 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; }
19577
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19576
19578
 
19577
- var MOUSE_ENTER_ATTRIBUTE = 'data-blot-formatter-unclickable-bound';
19578
- var PROXY_IMAGE_CLASS = 'blot-formatter__proxy-image';
19579
+ 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; }
19579
19580
 
19580
- var UnclickableBlotSpec = function (_BlotSpec) {
19581
- _inherits(UnclickableBlotSpec, _BlotSpec);
19581
+ 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; }
19582
19582
 
19583
- function UnclickableBlotSpec(formatter, selector) {
19584
- _classCallCheck(this, UnclickableBlotSpec);
19583
+ var MOUSE_ENTER_ATTRIBUTE = 'data-blot-formatter-unclickable-bound';
19584
+ var PROXY_IMAGE_CLASS = 'blot-formatter__proxy-image';
19585
19585
 
19586
- var _this = _possibleConstructorReturn(this, (UnclickableBlotSpec.__proto__ || Object.getPrototypeOf(UnclickableBlotSpec)).call(this, formatter));
19586
+ var UnclickableBlotSpec$1 = function (_BlotSpec) {
19587
+ _inherits(UnclickableBlotSpec, _BlotSpec);
19587
19588
 
19588
- _this.onTextChange = function () {
19589
- Array.from(document.querySelectorAll(_this.selector + ':not([' + MOUSE_ENTER_ATTRIBUTE + '])')).forEach(function (unclickable) {
19590
- unclickable.setAttribute(MOUSE_ENTER_ATTRIBUTE, 'true');
19591
- unclickable.addEventListener('mouseenter', _this.onMouseEnter);
19592
- });
19593
- };
19589
+ function UnclickableBlotSpec(formatter, selector) {
19590
+ _classCallCheck(this, UnclickableBlotSpec);
19594
19591
 
19595
- _this.onMouseEnter = function (event) {
19596
- var unclickable = event.target;
19597
- if (!(unclickable instanceof HTMLElement)) {
19598
- return;
19599
- }
19592
+ var _this = _possibleConstructorReturn(this, (UnclickableBlotSpec.__proto__ || Object.getPrototypeOf(UnclickableBlotSpec)).call(this, formatter));
19600
19593
 
19601
- _this.nextUnclickable = unclickable;
19602
- _this.repositionProxyImage(_this.nextUnclickable);
19603
- };
19594
+ _this.onTextChange = function () {
19595
+ Array.from(document.querySelectorAll(_this.selector + ':not([' + MOUSE_ENTER_ATTRIBUTE + '])')).forEach(function (unclickable) {
19596
+ unclickable.setAttribute(MOUSE_ENTER_ATTRIBUTE, 'true');
19597
+ unclickable.addEventListener('mouseenter', _this.onMouseEnter);
19598
+ });
19599
+ };
19604
19600
 
19605
- _this.onProxyImageClick = function () {
19606
- _this.unclickable = _this.nextUnclickable;
19607
- _this.nextUnclickable = null;
19608
- _this.formatter.show(_this);
19609
- _this.hideProxyImage();
19610
- };
19601
+ _this.onMouseEnter = function (event) {
19602
+ var unclickable = event.target;
19603
+ if (!(unclickable instanceof HTMLElement)) {
19604
+ return;
19605
+ }
19611
19606
 
19612
- _this.selector = selector;
19613
- _this.unclickable = null;
19614
- _this.nextUnclickable = null;
19615
- return _this;
19616
- }
19607
+ _this.nextUnclickable = unclickable;
19608
+ _this.repositionProxyImage(_this.nextUnclickable);
19609
+ };
19617
19610
 
19618
- _createClass(UnclickableBlotSpec, [{
19619
- key: 'init',
19620
- value: function init() {
19621
- if (document.body) {
19622
- /*
19623
- it's important that this is attached to the body instead of the root quill element.
19624
- this prevents the click event from overlapping with ImageSpec
19625
- */
19626
- document.body.appendChild(this.createProxyImage());
19627
- }
19611
+ _this.onProxyImageClick = function () {
19612
+ _this.unclickable = _this.nextUnclickable;
19613
+ _this.nextUnclickable = null;
19614
+ _this.formatter.show(_this);
19615
+ _this.hideProxyImage();
19616
+ };
19628
19617
 
19629
- this.hideProxyImage();
19630
- this.proxyImage.addEventListener('click', this.onProxyImageClick);
19631
- this.formatter.quill.on('text-change', this.onTextChange);
19632
- }
19633
- }, {
19634
- key: 'getTargetElement',
19635
- value: function getTargetElement() {
19636
- return this.unclickable;
19637
- }
19638
- }, {
19639
- key: 'getOverlayElement',
19640
- value: function getOverlayElement() {
19641
- return this.unclickable;
19642
- }
19643
- }, {
19644
- key: 'onHide',
19645
- value: function onHide() {
19646
- this.hideProxyImage();
19647
- this.nextUnclickable = null;
19648
- this.unclickable = null;
19649
- }
19650
- }, {
19651
- key: 'createProxyImage',
19652
- value: function createProxyImage() {
19653
- var canvas = document.createElement('canvas');
19654
- var context = canvas.getContext('2d');
19655
- context.globalAlpha = 0;
19656
- context.fillRect(0, 0, 1, 1);
19657
-
19658
- this.proxyImage = document.createElement('img');
19659
- this.proxyImage.src = canvas.toDataURL('image/png');
19660
- this.proxyImage.classList.add(PROXY_IMAGE_CLASS);
19661
-
19662
- Object.assign(this.proxyImage.style, {
19663
- position: 'absolute',
19664
- margin: '0'
19665
- });
19618
+ _this.selector = selector;
19619
+ _this.unclickable = null;
19620
+ _this.nextUnclickable = null;
19621
+ return _this;
19622
+ }
19666
19623
 
19667
- return this.proxyImage;
19668
- }
19669
- }, {
19670
- key: 'hideProxyImage',
19671
- value: function hideProxyImage() {
19672
- Object.assign(this.proxyImage.style, {
19673
- display: 'none'
19674
- });
19675
- }
19676
- }, {
19677
- key: 'repositionProxyImage',
19678
- value: function repositionProxyImage(unclickable) {
19679
- var rect = unclickable.getBoundingClientRect();
19680
-
19681
- Object.assign(this.proxyImage.style, {
19682
- display: 'block',
19683
- left: rect.left + window.pageXOffset + 'px',
19684
- top: rect.top + window.pageYOffset + 'px',
19685
- width: rect.width + 'px',
19686
- height: rect.height + 'px'
19687
- });
19688
- }
19689
- }]);
19624
+ _createClass(UnclickableBlotSpec, [{
19625
+ key: 'init',
19626
+ value: function init() {
19627
+ if (document.body) {
19628
+ /*
19629
+ it's important that this is attached to the body instead of the root quill element.
19630
+ this prevents the click event from overlapping with ImageSpec
19631
+ */
19632
+ document.body.appendChild(this.createProxyImage());
19633
+ }
19634
+
19635
+ this.hideProxyImage();
19636
+ this.proxyImage.addEventListener('click', this.onProxyImageClick);
19637
+ this.formatter.quill.on('text-change', this.onTextChange);
19638
+ }
19639
+ }, {
19640
+ key: 'getTargetElement',
19641
+ value: function getTargetElement() {
19642
+ return this.unclickable;
19643
+ }
19644
+ }, {
19645
+ key: 'getOverlayElement',
19646
+ value: function getOverlayElement() {
19647
+ return this.unclickable;
19648
+ }
19649
+ }, {
19650
+ key: 'onHide',
19651
+ value: function onHide() {
19652
+ this.hideProxyImage();
19653
+ this.nextUnclickable = null;
19654
+ this.unclickable = null;
19655
+ }
19656
+ }, {
19657
+ key: 'createProxyImage',
19658
+ value: function createProxyImage() {
19659
+ var canvas = document.createElement('canvas');
19660
+ var context = canvas.getContext('2d');
19661
+ context.globalAlpha = 0;
19662
+ context.fillRect(0, 0, 1, 1);
19663
+
19664
+ this.proxyImage = document.createElement('img');
19665
+ this.proxyImage.src = canvas.toDataURL('image/png');
19666
+ this.proxyImage.classList.add(PROXY_IMAGE_CLASS);
19667
+
19668
+ Object.assign(this.proxyImage.style, {
19669
+ position: 'absolute',
19670
+ margin: '0'
19671
+ });
19690
19672
 
19691
- return UnclickableBlotSpec;
19692
- }(_BlotSpec3.default);
19673
+ return this.proxyImage;
19674
+ }
19675
+ }, {
19676
+ key: 'hideProxyImage',
19677
+ value: function hideProxyImage() {
19678
+ Object.assign(this.proxyImage.style, {
19679
+ display: 'none'
19680
+ });
19681
+ }
19682
+ }, {
19683
+ key: 'repositionProxyImage',
19684
+ value: function repositionProxyImage(unclickable) {
19685
+ var rect = unclickable.getBoundingClientRect();
19693
19686
 
19694
- UnclickableBlotSpec$1.default = UnclickableBlotSpec;
19687
+ Object.assign(this.proxyImage.style, {
19688
+ display: 'block',
19689
+ left: rect.left + window.pageXOffset + 'px',
19690
+ top: rect.top + window.pageYOffset + 'px',
19691
+ width: rect.width + 'px',
19692
+ height: rect.height + 'px'
19693
+ });
19694
+ }
19695
+ }]);
19696
+
19697
+ return UnclickableBlotSpec;
19698
+ }(_BlotSpec3.default);
19699
+
19700
+ UnclickableBlotSpec.default = UnclickableBlotSpec$1;
19701
+ return UnclickableBlotSpec;
19702
+ }
19695
19703
 
19696
19704
  var hasRequiredIframeVideoSpec;
19697
19705
 
@@ -19703,7 +19711,7 @@
19703
19711
  value: true
19704
19712
  });
19705
19713
 
19706
- var _UnclickableBlotSpec2 = UnclickableBlotSpec$1;
19714
+ var _UnclickableBlotSpec2 = requireUnclickableBlotSpec();
19707
19715
 
19708
19716
  var _UnclickableBlotSpec3 = _interopRequireDefault(_UnclickableBlotSpec2);
19709
19717
 
@@ -19930,7 +19938,7 @@
19930
19938
  }
19931
19939
  });
19932
19940
 
19933
- var _UnclickableBlotSpec = UnclickableBlotSpec$1;
19941
+ var _UnclickableBlotSpec = requireUnclickableBlotSpec();
19934
19942
 
19935
19943
  Object.defineProperty(exports, 'UnclickableBlotSpec', {
19936
19944
  enumerable: true,
@@ -20448,6 +20456,13 @@
20448
20456
  };
20449
20457
  const handleTextChange = (delta, oldContents, source) => {
20450
20458
  internalModel = maybeClone(getContents());
20459
+ // 因为默认是<p><br></p>,影响element-ui的表单验证,所以默认设为空,有值才显示<p>内容</p>
20460
+ if (props.contentType === 'html') {
20461
+ const html = getHTML();
20462
+ if (html === '' || html === '<p><br></p>' || html === '<p></p>') {
20463
+ internalModel = '';
20464
+ }
20465
+ }
20451
20466
  if (!internalModelEquals(props.content)) {
20452
20467
  ctx.emit('update:content', internalModel);
20453
20468
  }
@@ -20523,7 +20538,15 @@
20523
20538
  : ''
20524
20539
  : content;
20525
20540
  if (props.contentType === 'html') {
20526
- setHTML(normalizedContent);
20541
+ // 对于空内容,直接清空编辑器,不插入默认结构
20542
+ if (!normalizedContent || normalizedContent === '') {
20543
+ if (quill) {
20544
+ quill.root.innerHTML = '';
20545
+ }
20546
+ }
20547
+ else {
20548
+ setHTML(normalizedContent);
20549
+ }
20527
20550
  }
20528
20551
  else if (props.contentType === 'text') {
20529
20552
  setText(normalizedContent, source);
@@ -20542,7 +20565,12 @@
20542
20565
  };
20543
20566
  const getHTML = () => {
20544
20567
  var _a;
20545
- return (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
20568
+ const html = (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
20569
+ // 如果内容是默认的空段落结构,返回空字符串
20570
+ if (html === '<p><br></p>' || html === '<p></p>') {
20571
+ return '';
20572
+ }
20573
+ return html;
20546
20574
  };
20547
20575
  const setHTML = (html) => {
20548
20576
  if (quill)