pxx-vue-quill 1.0.87 → 1.0.89

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-08T04:14:12.416Z
10
+ * Date: 2025-09-08T04:21:54.197Z
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$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; }; }();
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; }; }();
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$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18788
+ function _classCallCheck(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$1(this, DefaultAligner);
18799
+ _classCallCheck(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$1(DefaultAligner, [{
18827
+ _createClass(DefaultAligner, [{
18828
18828
  key: 'getAlignments',
18829
18829
  value: function getAlignments() {
18830
18830
  var _this2 = this;
@@ -19549,148 +19549,156 @@
19549
19549
 
19550
19550
  var IframeVideoSpec = {};
19551
19551
 
19552
- var UnclickableBlotSpec$1 = {};
19552
+ var UnclickableBlotSpec = {};
19553
19553
 
19554
- Object.defineProperty(UnclickableBlotSpec$1, "__esModule", {
19555
- value: true
19556
- });
19554
+ var hasRequiredUnclickableBlotSpec;
19557
19555
 
19558
- 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; }; }();
19556
+ function requireUnclickableBlotSpec () {
19557
+ if (hasRequiredUnclickableBlotSpec) return UnclickableBlotSpec;
19558
+ hasRequiredUnclickableBlotSpec = 1;
19559
19559
 
19560
- var _BlotSpec2 = requireBlotSpec();
19560
+ Object.defineProperty(UnclickableBlotSpec, "__esModule", {
19561
+ value: true
19562
+ });
19561
19563
 
19562
- var _BlotSpec3 = _interopRequireDefault(_BlotSpec2);
19564
+ 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; }; }();
19563
19565
 
19564
- var _BlotFormatter = requireBlotFormatter();
19566
+ var _BlotSpec2 = requireBlotSpec();
19565
19567
 
19566
- _interopRequireDefault(_BlotFormatter);
19568
+ var _BlotSpec3 = _interopRequireDefault(_BlotSpec2);
19567
19569
 
19568
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19570
+ var _BlotFormatter = requireBlotFormatter();
19569
19571
 
19570
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19572
+ _interopRequireDefault(_BlotFormatter);
19571
19573
 
19572
- 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; }
19574
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19573
19575
 
19574
- 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; }
19576
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19575
19577
 
19576
- var MOUSE_ENTER_ATTRIBUTE = 'data-blot-formatter-unclickable-bound';
19577
- var PROXY_IMAGE_CLASS = 'blot-formatter__proxy-image';
19578
+ 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; }
19578
19579
 
19579
- var UnclickableBlotSpec = function (_BlotSpec) {
19580
- _inherits(UnclickableBlotSpec, _BlotSpec);
19580
+ 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; }
19581
19581
 
19582
- function UnclickableBlotSpec(formatter, selector) {
19583
- _classCallCheck(this, UnclickableBlotSpec);
19582
+ var MOUSE_ENTER_ATTRIBUTE = 'data-blot-formatter-unclickable-bound';
19583
+ var PROXY_IMAGE_CLASS = 'blot-formatter__proxy-image';
19584
19584
 
19585
- var _this = _possibleConstructorReturn(this, (UnclickableBlotSpec.__proto__ || Object.getPrototypeOf(UnclickableBlotSpec)).call(this, formatter));
19585
+ var UnclickableBlotSpec$1 = function (_BlotSpec) {
19586
+ _inherits(UnclickableBlotSpec, _BlotSpec);
19586
19587
 
19587
- _this.onTextChange = function () {
19588
- Array.from(document.querySelectorAll(_this.selector + ':not([' + MOUSE_ENTER_ATTRIBUTE + '])')).forEach(function (unclickable) {
19589
- unclickable.setAttribute(MOUSE_ENTER_ATTRIBUTE, 'true');
19590
- unclickable.addEventListener('mouseenter', _this.onMouseEnter);
19591
- });
19592
- };
19588
+ function UnclickableBlotSpec(formatter, selector) {
19589
+ _classCallCheck(this, UnclickableBlotSpec);
19593
19590
 
19594
- _this.onMouseEnter = function (event) {
19595
- var unclickable = event.target;
19596
- if (!(unclickable instanceof HTMLElement)) {
19597
- return;
19598
- }
19591
+ var _this = _possibleConstructorReturn(this, (UnclickableBlotSpec.__proto__ || Object.getPrototypeOf(UnclickableBlotSpec)).call(this, formatter));
19599
19592
 
19600
- _this.nextUnclickable = unclickable;
19601
- _this.repositionProxyImage(_this.nextUnclickable);
19602
- };
19593
+ _this.onTextChange = function () {
19594
+ Array.from(document.querySelectorAll(_this.selector + ':not([' + MOUSE_ENTER_ATTRIBUTE + '])')).forEach(function (unclickable) {
19595
+ unclickable.setAttribute(MOUSE_ENTER_ATTRIBUTE, 'true');
19596
+ unclickable.addEventListener('mouseenter', _this.onMouseEnter);
19597
+ });
19598
+ };
19603
19599
 
19604
- _this.onProxyImageClick = function () {
19605
- _this.unclickable = _this.nextUnclickable;
19606
- _this.nextUnclickable = null;
19607
- _this.formatter.show(_this);
19608
- _this.hideProxyImage();
19609
- };
19600
+ _this.onMouseEnter = function (event) {
19601
+ var unclickable = event.target;
19602
+ if (!(unclickable instanceof HTMLElement)) {
19603
+ return;
19604
+ }
19610
19605
 
19611
- _this.selector = selector;
19612
- _this.unclickable = null;
19613
- _this.nextUnclickable = null;
19614
- return _this;
19615
- }
19606
+ _this.nextUnclickable = unclickable;
19607
+ _this.repositionProxyImage(_this.nextUnclickable);
19608
+ };
19616
19609
 
19617
- _createClass(UnclickableBlotSpec, [{
19618
- key: 'init',
19619
- value: function init() {
19620
- if (document.body) {
19621
- /*
19622
- it's important that this is attached to the body instead of the root quill element.
19623
- this prevents the click event from overlapping with ImageSpec
19624
- */
19625
- document.body.appendChild(this.createProxyImage());
19626
- }
19610
+ _this.onProxyImageClick = function () {
19611
+ _this.unclickable = _this.nextUnclickable;
19612
+ _this.nextUnclickable = null;
19613
+ _this.formatter.show(_this);
19614
+ _this.hideProxyImage();
19615
+ };
19627
19616
 
19628
- this.hideProxyImage();
19629
- this.proxyImage.addEventListener('click', this.onProxyImageClick);
19630
- this.formatter.quill.on('text-change', this.onTextChange);
19631
- }
19632
- }, {
19633
- key: 'getTargetElement',
19634
- value: function getTargetElement() {
19635
- return this.unclickable;
19636
- }
19637
- }, {
19638
- key: 'getOverlayElement',
19639
- value: function getOverlayElement() {
19640
- return this.unclickable;
19641
- }
19642
- }, {
19643
- key: 'onHide',
19644
- value: function onHide() {
19645
- this.hideProxyImage();
19646
- this.nextUnclickable = null;
19647
- this.unclickable = null;
19648
- }
19649
- }, {
19650
- key: 'createProxyImage',
19651
- value: function createProxyImage() {
19652
- var canvas = document.createElement('canvas');
19653
- var context = canvas.getContext('2d');
19654
- context.globalAlpha = 0;
19655
- context.fillRect(0, 0, 1, 1);
19656
-
19657
- this.proxyImage = document.createElement('img');
19658
- this.proxyImage.src = canvas.toDataURL('image/png');
19659
- this.proxyImage.classList.add(PROXY_IMAGE_CLASS);
19660
-
19661
- Object.assign(this.proxyImage.style, {
19662
- position: 'absolute',
19663
- margin: '0'
19664
- });
19617
+ _this.selector = selector;
19618
+ _this.unclickable = null;
19619
+ _this.nextUnclickable = null;
19620
+ return _this;
19621
+ }
19665
19622
 
19666
- return this.proxyImage;
19667
- }
19668
- }, {
19669
- key: 'hideProxyImage',
19670
- value: function hideProxyImage() {
19671
- Object.assign(this.proxyImage.style, {
19672
- display: 'none'
19673
- });
19674
- }
19675
- }, {
19676
- key: 'repositionProxyImage',
19677
- value: function repositionProxyImage(unclickable) {
19678
- var rect = unclickable.getBoundingClientRect();
19679
-
19680
- Object.assign(this.proxyImage.style, {
19681
- display: 'block',
19682
- left: rect.left + window.pageXOffset + 'px',
19683
- top: rect.top + window.pageYOffset + 'px',
19684
- width: rect.width + 'px',
19685
- height: rect.height + 'px'
19686
- });
19687
- }
19688
- }]);
19623
+ _createClass(UnclickableBlotSpec, [{
19624
+ key: 'init',
19625
+ value: function init() {
19626
+ if (document.body) {
19627
+ /*
19628
+ it's important that this is attached to the body instead of the root quill element.
19629
+ this prevents the click event from overlapping with ImageSpec
19630
+ */
19631
+ document.body.appendChild(this.createProxyImage());
19632
+ }
19689
19633
 
19690
- return UnclickableBlotSpec;
19691
- }(_BlotSpec3.default);
19634
+ this.hideProxyImage();
19635
+ this.proxyImage.addEventListener('click', this.onProxyImageClick);
19636
+ this.formatter.quill.on('text-change', this.onTextChange);
19637
+ }
19638
+ }, {
19639
+ key: 'getTargetElement',
19640
+ value: function getTargetElement() {
19641
+ return this.unclickable;
19642
+ }
19643
+ }, {
19644
+ key: 'getOverlayElement',
19645
+ value: function getOverlayElement() {
19646
+ return this.unclickable;
19647
+ }
19648
+ }, {
19649
+ key: 'onHide',
19650
+ value: function onHide() {
19651
+ this.hideProxyImage();
19652
+ this.nextUnclickable = null;
19653
+ this.unclickable = null;
19654
+ }
19655
+ }, {
19656
+ key: 'createProxyImage',
19657
+ value: function createProxyImage() {
19658
+ var canvas = document.createElement('canvas');
19659
+ var context = canvas.getContext('2d');
19660
+ context.globalAlpha = 0;
19661
+ context.fillRect(0, 0, 1, 1);
19662
+
19663
+ this.proxyImage = document.createElement('img');
19664
+ this.proxyImage.src = canvas.toDataURL('image/png');
19665
+ this.proxyImage.classList.add(PROXY_IMAGE_CLASS);
19666
+
19667
+ Object.assign(this.proxyImage.style, {
19668
+ position: 'absolute',
19669
+ margin: '0'
19670
+ });
19692
19671
 
19693
- UnclickableBlotSpec$1.default = UnclickableBlotSpec;
19672
+ return this.proxyImage;
19673
+ }
19674
+ }, {
19675
+ key: 'hideProxyImage',
19676
+ value: function hideProxyImage() {
19677
+ Object.assign(this.proxyImage.style, {
19678
+ display: 'none'
19679
+ });
19680
+ }
19681
+ }, {
19682
+ key: 'repositionProxyImage',
19683
+ value: function repositionProxyImage(unclickable) {
19684
+ var rect = unclickable.getBoundingClientRect();
19685
+
19686
+ Object.assign(this.proxyImage.style, {
19687
+ display: 'block',
19688
+ left: rect.left + window.pageXOffset + 'px',
19689
+ top: rect.top + window.pageYOffset + 'px',
19690
+ width: rect.width + 'px',
19691
+ height: rect.height + 'px'
19692
+ });
19693
+ }
19694
+ }]);
19695
+
19696
+ return UnclickableBlotSpec;
19697
+ }(_BlotSpec3.default);
19698
+
19699
+ UnclickableBlotSpec.default = UnclickableBlotSpec$1;
19700
+ return UnclickableBlotSpec;
19701
+ }
19694
19702
 
19695
19703
  var hasRequiredIframeVideoSpec;
19696
19704
 
@@ -19702,7 +19710,7 @@
19702
19710
  value: true
19703
19711
  });
19704
19712
 
19705
- var _UnclickableBlotSpec2 = UnclickableBlotSpec$1;
19713
+ var _UnclickableBlotSpec2 = requireUnclickableBlotSpec();
19706
19714
 
19707
19715
  var _UnclickableBlotSpec3 = _interopRequireDefault(_UnclickableBlotSpec2);
19708
19716
 
@@ -19929,7 +19937,7 @@
19929
19937
  }
19930
19938
  });
19931
19939
 
19932
- var _UnclickableBlotSpec = UnclickableBlotSpec$1;
19940
+ var _UnclickableBlotSpec = requireUnclickableBlotSpec();
19933
19941
 
19934
19942
  Object.defineProperty(exports, 'UnclickableBlotSpec', {
19935
19943
  enumerable: true,
@@ -20167,10 +20175,8 @@
20167
20175
  vue.onMounted(() => {
20168
20176
  initialize();
20169
20177
  console.log("onMounted handleGlobalClick");
20170
- vue.nextTick(() => {
20171
- window.addEventListener('click', handleGlobalClick, true);
20172
- window.addEventListener('keyup', handleGlobalKeyup, true);
20173
- });
20178
+ window.addEventListener('click', handleGlobalClick, true);
20179
+ window.addEventListener('keyup', handleGlobalKeyup, true);
20174
20180
  });
20175
20181
  const removeQuillBlotFormatter = () => {
20176
20182
  console.log("removeQuillBlotFormatter");
@@ -20282,6 +20288,8 @@
20282
20288
  var _a, _b;
20283
20289
  if (!editor.value)
20284
20290
  return;
20291
+ registerModule('modules/blotFormatter', BlotFormatter);
20292
+ options = composeOptions();
20285
20293
  quill = new Quill(editor.value, options);
20286
20294
  const toolbar = (_a = quill === null || quill === void 0 ? void 0 : quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
20287
20295
  if (toolbar) {
@@ -20298,9 +20306,6 @@
20298
20306
  icons['ocr'] = ocrSVG;
20299
20307
  icons['math'] = mathSVG;
20300
20308
  icons['image'] = imageSVG;
20301
- options = composeOptions();
20302
- registerModule('modules/blotFormatter', BlotFormatter);
20303
- quill = new Quill(editor.value, options);
20304
20309
  setContents(props.content);
20305
20310
  quill.on('text-change', handleTextChange);
20306
20311
  quill.on('selection-change', handleSelectionChange);
@@ -20319,6 +20324,30 @@
20319
20324
  applyToolbarStyle();
20320
20325
  }
20321
20326
  applyEditorStyle();
20327
+ const blotFormatter = quill.getModule('blotFormatter');
20328
+ if (blotFormatter) {
20329
+ const originalShow = blotFormatter.show.bind(blotFormatter);
20330
+ blotFormatter.show = function (spec) {
20331
+ var _a;
20332
+ originalShow(spec);
20333
+ const target = (_a = this.currentSpec) === null || _a === void 0 ? void 0 : _a.getTargetElement();
20334
+ if (target && target.tagName === 'IMG') {
20335
+ target.style.maxWidth = '100%';
20336
+ target.style.height = 'auto';
20337
+ target.style.objectFit = 'contain';
20338
+ const width = target.getAttribute('width');
20339
+ if (width) {
20340
+ const naturalWidth = target.naturalWidth;
20341
+ const naturalHeight = target.naturalHeight;
20342
+ if (naturalWidth && naturalHeight) {
20343
+ const aspectRatio = naturalHeight / naturalWidth;
20344
+ const newHeight = Math.round(parseInt(width) * aspectRatio);
20345
+ target.setAttribute('height', '' + newHeight);
20346
+ }
20347
+ }
20348
+ }
20349
+ };
20350
+ }
20322
20351
  ctx.emit('ready', quill);
20323
20352
  };
20324
20353
  const composeOptions = () => {
@@ -20362,11 +20391,7 @@
20362
20391
  };
20363
20392
  }
20364
20393
  clientOptions.modules = Object.assign({}, clientOptions.modules, {
20365
- blotFormatter: {
20366
- keyboard: {
20367
- enabled: false
20368
- }
20369
- }
20394
+ blotFormatter: true
20370
20395
  });
20371
20396
  return Object.assign({}, props.globalOptions, props.options, clientOptions);
20372
20397
  };