pxx-vue-quill 1.0.91 → 1.0.93

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-08T13:52:15.208Z
10
+ * Date: 2025-09-08T14:33:05.870Z
11
11
  */
12
12
  (function (global, factory) {
13
13
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
@@ -18908,11 +18908,11 @@
18908
18908
  value: true
18909
18909
  });
18910
18910
 
18911
- 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; }; }();
18911
+ 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; }; }();
18912
18912
 
18913
18913
  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; }
18914
18914
 
18915
- function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18915
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18916
18916
 
18917
18917
  var LEFT_ALIGN = 'left';
18918
18918
  var CENTER_ALIGN = 'center';
@@ -18923,7 +18923,7 @@
18923
18923
  var _this = this,
18924
18924
  _alignments;
18925
18925
 
18926
- _classCallCheck$1(this, DefaultAligner);
18926
+ _classCallCheck(this, DefaultAligner);
18927
18927
 
18928
18928
  this.applyStyle = options.aligner.applyStyle;
18929
18929
  this.alignAttribute = options.attribute;
@@ -18951,7 +18951,7 @@
18951
18951
  }), _alignments);
18952
18952
  }
18953
18953
 
18954
- _createClass$1(DefaultAligner, [{
18954
+ _createClass(DefaultAligner, [{
18955
18955
  key: 'getAlignments',
18956
18956
  value: function getAlignments() {
18957
18957
  var _this2 = this;
@@ -19676,148 +19676,156 @@
19676
19676
 
19677
19677
  var IframeVideoSpec = {};
19678
19678
 
19679
- var UnclickableBlotSpec$1 = {};
19679
+ var UnclickableBlotSpec = {};
19680
19680
 
19681
- Object.defineProperty(UnclickableBlotSpec$1, "__esModule", {
19682
- value: true
19683
- });
19681
+ var hasRequiredUnclickableBlotSpec;
19684
19682
 
19685
- 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; }; }();
19683
+ function requireUnclickableBlotSpec () {
19684
+ if (hasRequiredUnclickableBlotSpec) return UnclickableBlotSpec;
19685
+ hasRequiredUnclickableBlotSpec = 1;
19686
19686
 
19687
- var _BlotSpec2 = requireBlotSpec();
19687
+ Object.defineProperty(UnclickableBlotSpec, "__esModule", {
19688
+ value: true
19689
+ });
19688
19690
 
19689
- var _BlotSpec3 = _interopRequireDefault(_BlotSpec2);
19691
+ 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; }; }();
19690
19692
 
19691
- var _BlotFormatter = requireBlotFormatter();
19693
+ var _BlotSpec2 = requireBlotSpec();
19692
19694
 
19693
- _interopRequireDefault(_BlotFormatter);
19695
+ var _BlotSpec3 = _interopRequireDefault(_BlotSpec2);
19694
19696
 
19695
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19697
+ var _BlotFormatter = requireBlotFormatter();
19696
19698
 
19697
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19699
+ _interopRequireDefault(_BlotFormatter);
19698
19700
 
19699
- 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; }
19701
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19700
19702
 
19701
- 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; }
19703
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19702
19704
 
19703
- var MOUSE_ENTER_ATTRIBUTE = 'data-blot-formatter-unclickable-bound';
19704
- var PROXY_IMAGE_CLASS = 'blot-formatter__proxy-image';
19705
+ 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; }
19705
19706
 
19706
- var UnclickableBlotSpec = function (_BlotSpec) {
19707
- _inherits(UnclickableBlotSpec, _BlotSpec);
19707
+ 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; }
19708
19708
 
19709
- function UnclickableBlotSpec(formatter, selector) {
19710
- _classCallCheck(this, UnclickableBlotSpec);
19709
+ var MOUSE_ENTER_ATTRIBUTE = 'data-blot-formatter-unclickable-bound';
19710
+ var PROXY_IMAGE_CLASS = 'blot-formatter__proxy-image';
19711
19711
 
19712
- var _this = _possibleConstructorReturn(this, (UnclickableBlotSpec.__proto__ || Object.getPrototypeOf(UnclickableBlotSpec)).call(this, formatter));
19712
+ var UnclickableBlotSpec$1 = function (_BlotSpec) {
19713
+ _inherits(UnclickableBlotSpec, _BlotSpec);
19713
19714
 
19714
- _this.onTextChange = function () {
19715
- Array.from(document.querySelectorAll(_this.selector + ':not([' + MOUSE_ENTER_ATTRIBUTE + '])')).forEach(function (unclickable) {
19716
- unclickable.setAttribute(MOUSE_ENTER_ATTRIBUTE, 'true');
19717
- unclickable.addEventListener('mouseenter', _this.onMouseEnter);
19718
- });
19719
- };
19715
+ function UnclickableBlotSpec(formatter, selector) {
19716
+ _classCallCheck(this, UnclickableBlotSpec);
19720
19717
 
19721
- _this.onMouseEnter = function (event) {
19722
- var unclickable = event.target;
19723
- if (!(unclickable instanceof HTMLElement)) {
19724
- return;
19725
- }
19718
+ var _this = _possibleConstructorReturn(this, (UnclickableBlotSpec.__proto__ || Object.getPrototypeOf(UnclickableBlotSpec)).call(this, formatter));
19726
19719
 
19727
- _this.nextUnclickable = unclickable;
19728
- _this.repositionProxyImage(_this.nextUnclickable);
19729
- };
19720
+ _this.onTextChange = function () {
19721
+ Array.from(document.querySelectorAll(_this.selector + ':not([' + MOUSE_ENTER_ATTRIBUTE + '])')).forEach(function (unclickable) {
19722
+ unclickable.setAttribute(MOUSE_ENTER_ATTRIBUTE, 'true');
19723
+ unclickable.addEventListener('mouseenter', _this.onMouseEnter);
19724
+ });
19725
+ };
19730
19726
 
19731
- _this.onProxyImageClick = function () {
19732
- _this.unclickable = _this.nextUnclickable;
19733
- _this.nextUnclickable = null;
19734
- _this.formatter.show(_this);
19735
- _this.hideProxyImage();
19736
- };
19727
+ _this.onMouseEnter = function (event) {
19728
+ var unclickable = event.target;
19729
+ if (!(unclickable instanceof HTMLElement)) {
19730
+ return;
19731
+ }
19737
19732
 
19738
- _this.selector = selector;
19739
- _this.unclickable = null;
19740
- _this.nextUnclickable = null;
19741
- return _this;
19742
- }
19733
+ _this.nextUnclickable = unclickable;
19734
+ _this.repositionProxyImage(_this.nextUnclickable);
19735
+ };
19743
19736
 
19744
- _createClass(UnclickableBlotSpec, [{
19745
- key: 'init',
19746
- value: function init() {
19747
- if (document.body) {
19748
- /*
19749
- it's important that this is attached to the body instead of the root quill element.
19750
- this prevents the click event from overlapping with ImageSpec
19751
- */
19752
- document.body.appendChild(this.createProxyImage());
19753
- }
19737
+ _this.onProxyImageClick = function () {
19738
+ _this.unclickable = _this.nextUnclickable;
19739
+ _this.nextUnclickable = null;
19740
+ _this.formatter.show(_this);
19741
+ _this.hideProxyImage();
19742
+ };
19754
19743
 
19755
- this.hideProxyImage();
19756
- this.proxyImage.addEventListener('click', this.onProxyImageClick);
19757
- this.formatter.quill.on('text-change', this.onTextChange);
19758
- }
19759
- }, {
19760
- key: 'getTargetElement',
19761
- value: function getTargetElement() {
19762
- return this.unclickable;
19763
- }
19764
- }, {
19765
- key: 'getOverlayElement',
19766
- value: function getOverlayElement() {
19767
- return this.unclickable;
19768
- }
19769
- }, {
19770
- key: 'onHide',
19771
- value: function onHide() {
19772
- this.hideProxyImage();
19773
- this.nextUnclickable = null;
19774
- this.unclickable = null;
19775
- }
19776
- }, {
19777
- key: 'createProxyImage',
19778
- value: function createProxyImage() {
19779
- var canvas = document.createElement('canvas');
19780
- var context = canvas.getContext('2d');
19781
- context.globalAlpha = 0;
19782
- context.fillRect(0, 0, 1, 1);
19783
-
19784
- this.proxyImage = document.createElement('img');
19785
- this.proxyImage.src = canvas.toDataURL('image/png');
19786
- this.proxyImage.classList.add(PROXY_IMAGE_CLASS);
19787
-
19788
- Object.assign(this.proxyImage.style, {
19789
- position: 'absolute',
19790
- margin: '0'
19791
- });
19744
+ _this.selector = selector;
19745
+ _this.unclickable = null;
19746
+ _this.nextUnclickable = null;
19747
+ return _this;
19748
+ }
19792
19749
 
19793
- return this.proxyImage;
19794
- }
19795
- }, {
19796
- key: 'hideProxyImage',
19797
- value: function hideProxyImage() {
19798
- Object.assign(this.proxyImage.style, {
19799
- display: 'none'
19800
- });
19801
- }
19802
- }, {
19803
- key: 'repositionProxyImage',
19804
- value: function repositionProxyImage(unclickable) {
19805
- var rect = unclickable.getBoundingClientRect();
19806
-
19807
- Object.assign(this.proxyImage.style, {
19808
- display: 'block',
19809
- left: rect.left + window.pageXOffset + 'px',
19810
- top: rect.top + window.pageYOffset + 'px',
19811
- width: rect.width + 'px',
19812
- height: rect.height + 'px'
19813
- });
19814
- }
19815
- }]);
19750
+ _createClass(UnclickableBlotSpec, [{
19751
+ key: 'init',
19752
+ value: function init() {
19753
+ if (document.body) {
19754
+ /*
19755
+ it's important that this is attached to the body instead of the root quill element.
19756
+ this prevents the click event from overlapping with ImageSpec
19757
+ */
19758
+ document.body.appendChild(this.createProxyImage());
19759
+ }
19760
+
19761
+ this.hideProxyImage();
19762
+ this.proxyImage.addEventListener('click', this.onProxyImageClick);
19763
+ this.formatter.quill.on('text-change', this.onTextChange);
19764
+ }
19765
+ }, {
19766
+ key: 'getTargetElement',
19767
+ value: function getTargetElement() {
19768
+ return this.unclickable;
19769
+ }
19770
+ }, {
19771
+ key: 'getOverlayElement',
19772
+ value: function getOverlayElement() {
19773
+ return this.unclickable;
19774
+ }
19775
+ }, {
19776
+ key: 'onHide',
19777
+ value: function onHide() {
19778
+ this.hideProxyImage();
19779
+ this.nextUnclickable = null;
19780
+ this.unclickable = null;
19781
+ }
19782
+ }, {
19783
+ key: 'createProxyImage',
19784
+ value: function createProxyImage() {
19785
+ var canvas = document.createElement('canvas');
19786
+ var context = canvas.getContext('2d');
19787
+ context.globalAlpha = 0;
19788
+ context.fillRect(0, 0, 1, 1);
19789
+
19790
+ this.proxyImage = document.createElement('img');
19791
+ this.proxyImage.src = canvas.toDataURL('image/png');
19792
+ this.proxyImage.classList.add(PROXY_IMAGE_CLASS);
19793
+
19794
+ Object.assign(this.proxyImage.style, {
19795
+ position: 'absolute',
19796
+ margin: '0'
19797
+ });
19798
+
19799
+ return this.proxyImage;
19800
+ }
19801
+ }, {
19802
+ key: 'hideProxyImage',
19803
+ value: function hideProxyImage() {
19804
+ Object.assign(this.proxyImage.style, {
19805
+ display: 'none'
19806
+ });
19807
+ }
19808
+ }, {
19809
+ key: 'repositionProxyImage',
19810
+ value: function repositionProxyImage(unclickable) {
19811
+ var rect = unclickable.getBoundingClientRect();
19812
+
19813
+ Object.assign(this.proxyImage.style, {
19814
+ display: 'block',
19815
+ left: rect.left + window.pageXOffset + 'px',
19816
+ top: rect.top + window.pageYOffset + 'px',
19817
+ width: rect.width + 'px',
19818
+ height: rect.height + 'px'
19819
+ });
19820
+ }
19821
+ }]);
19816
19822
 
19817
- return UnclickableBlotSpec;
19818
- }(_BlotSpec3.default);
19823
+ return UnclickableBlotSpec;
19824
+ }(_BlotSpec3.default);
19819
19825
 
19820
- UnclickableBlotSpec$1.default = UnclickableBlotSpec;
19826
+ UnclickableBlotSpec.default = UnclickableBlotSpec$1;
19827
+ return UnclickableBlotSpec;
19828
+ }
19821
19829
 
19822
19830
  var hasRequiredIframeVideoSpec;
19823
19831
 
@@ -19829,7 +19837,7 @@
19829
19837
  value: true
19830
19838
  });
19831
19839
 
19832
- var _UnclickableBlotSpec2 = UnclickableBlotSpec$1;
19840
+ var _UnclickableBlotSpec2 = requireUnclickableBlotSpec();
19833
19841
 
19834
19842
  var _UnclickableBlotSpec3 = _interopRequireDefault(_UnclickableBlotSpec2);
19835
19843
 
@@ -20056,7 +20064,7 @@
20056
20064
  }
20057
20065
  });
20058
20066
 
20059
- var _UnclickableBlotSpec = UnclickableBlotSpec$1;
20067
+ var _UnclickableBlotSpec = requireUnclickableBlotSpec();
20060
20068
 
20061
20069
  Object.defineProperty(exports, 'UnclickableBlotSpec', {
20062
20070
  enumerable: true,
@@ -20177,12 +20185,18 @@
20177
20185
  }
20178
20186
  };
20179
20187
  const registerBlotFormatter = () => {
20180
- Quill.register('modules/blotFormatter', BlotFormatter);
20188
+ var _a;
20189
+ try {
20190
+ if (!((_a = Quill.imports) === null || _a === void 0 ? void 0 : _a['modules/blotFormatter'])) {
20191
+ Quill.register('modules/blotFormatter', BlotFormatter);
20192
+ }
20193
+ }
20194
+ catch (error) {
20195
+ console.warn('注册BlotFormatter模块时出错:', error);
20196
+ }
20181
20197
  };
20182
20198
  const getBlotFormatterConfig = () => {
20183
- return {
20184
- blotFormatter: true
20185
- };
20199
+ return {};
20186
20200
  };
20187
20201
  vue.onMounted(() => {
20188
20202
  window.addEventListener('click', handleGlobalClick, true);
@@ -20332,27 +20346,33 @@
20332
20346
  }
20333
20347
  }
20334
20348
  };
20335
- const setIcons = async () => {
20336
- const icons = await Quill.import('ui/icons');
20337
- icons['bold'] = boldSVG;
20338
- icons['italic'] = italicSVG;
20339
- icons['underline'] = underlineSVG;
20340
- icons['more'] = moreSVG;
20341
- icons['link'] = linkSVG;
20342
- icons['undo'] = undoSVG;
20343
- icons['redo'] = redoSVG;
20344
- icons['ocr'] = ocrSVG;
20345
- icons['math'] = mathSVG;
20346
- icons['image'] = imageSVG;
20347
- return icons;
20349
+ const setIcons = () => {
20350
+ try {
20351
+ const icons = Quill.import('ui/icons');
20352
+ if (icons) {
20353
+ icons['bold'] = boldSVG;
20354
+ icons['italic'] = italicSVG;
20355
+ icons['underline'] = underlineSVG;
20356
+ icons['more'] = moreSVG;
20357
+ icons['link'] = linkSVG;
20358
+ icons['undo'] = undoSVG;
20359
+ icons['redo'] = redoSVG;
20360
+ icons['ocr'] = ocrSVG;
20361
+ icons['math'] = mathSVG;
20362
+ icons['image'] = imageSVG;
20363
+ }
20364
+ }
20365
+ catch (error) {
20366
+ console.warn('设置图标时出错:', error);
20367
+ }
20348
20368
  };
20349
- const initialize = async () => {
20369
+ const initialize = () => {
20350
20370
  var _a, _b;
20351
20371
  if (!editor.value)
20352
20372
  return;
20353
20373
  registerBlotFormatter();
20354
20374
  options = composeOptions();
20355
- await setIcons();
20375
+ setIcons();
20356
20376
  quill = new Quill(editor.value, options);
20357
20377
  setQuill(quill);
20358
20378
  const toolbar = (_a = quill === null || quill === void 0 ? void 0 : quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
@@ -20420,7 +20440,10 @@
20420
20440
  },
20421
20441
  };
20422
20442
  }
20423
- clientOptions.modules = Object.assign({}, clientOptions.modules, getBlotFormatterConfig());
20443
+ const blotFormatterConfig = getBlotFormatterConfig();
20444
+ if (Object.keys(blotFormatterConfig).length > 0) {
20445
+ clientOptions.modules = Object.assign({}, clientOptions.modules, blotFormatterConfig);
20446
+ }
20424
20447
  return Object.assign({}, props.globalOptions, props.options, clientOptions);
20425
20448
  };
20426
20449
  const maybeClone = (delta) => {