pxx-vue-quill 1.0.163 → 1.0.165

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-15T03:56:15.666Z
10
+ * Date: 2025-09-16T10:45:27.072Z
11
11
  */
12
12
  (function (global, factory) {
13
13
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
@@ -18994,11 +18994,11 @@
18994
18994
  value: true
18995
18995
  });
18996
18996
 
18997
- 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; }; }();
18997
+ 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; }; }();
18998
18998
 
18999
18999
  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; }
19000
19000
 
19001
- function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19001
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19002
19002
 
19003
19003
  var LEFT_ALIGN = 'left';
19004
19004
  var CENTER_ALIGN = 'center';
@@ -19009,7 +19009,7 @@
19009
19009
  var _this = this,
19010
19010
  _alignments;
19011
19011
 
19012
- _classCallCheck$1(this, DefaultAligner);
19012
+ _classCallCheck(this, DefaultAligner);
19013
19013
 
19014
19014
  this.applyStyle = options.aligner.applyStyle;
19015
19015
  this.alignAttribute = options.attribute;
@@ -19037,7 +19037,7 @@
19037
19037
  }), _alignments);
19038
19038
  }
19039
19039
 
19040
- _createClass$1(DefaultAligner, [{
19040
+ _createClass(DefaultAligner, [{
19041
19041
  key: 'getAlignments',
19042
19042
  value: function getAlignments() {
19043
19043
  var _this2 = this;
@@ -19340,182 +19340,190 @@
19340
19340
  return AlignAction;
19341
19341
  }
19342
19342
 
19343
- var ResizeAction$1 = {};
19343
+ var ResizeAction = {};
19344
19344
 
19345
- Object.defineProperty(ResizeAction$1, "__esModule", {
19346
- value: true
19347
- });
19345
+ var hasRequiredResizeAction;
19348
19346
 
19349
- 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; }; }();
19347
+ function requireResizeAction () {
19348
+ if (hasRequiredResizeAction) return ResizeAction;
19349
+ hasRequiredResizeAction = 1;
19350
19350
 
19351
- var _Action2 = requireAction();
19351
+ Object.defineProperty(ResizeAction, "__esModule", {
19352
+ value: true
19353
+ });
19352
19354
 
19353
- var _Action3 = _interopRequireDefault(_Action2);
19355
+ 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; }; }();
19354
19356
 
19355
- var _BlotFormatter = requireBlotFormatter();
19357
+ var _Action2 = requireAction();
19356
19358
 
19357
- _interopRequireDefault(_BlotFormatter);
19359
+ var _Action3 = _interopRequireDefault(_Action2);
19358
19360
 
19359
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19361
+ var _BlotFormatter = requireBlotFormatter();
19360
19362
 
19361
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19363
+ _interopRequireDefault(_BlotFormatter);
19362
19364
 
19363
- 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; }
19365
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19364
19366
 
19365
- 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; }
19367
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
19366
19368
 
19367
- var ResizeAction = function (_Action) {
19368
- _inherits(ResizeAction, _Action);
19369
+ 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; }
19369
19370
 
19370
- function ResizeAction(formatter) {
19371
- _classCallCheck(this, ResizeAction);
19371
+ 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; }
19372
19372
 
19373
- var _this = _possibleConstructorReturn(this, (ResizeAction.__proto__ || Object.getPrototypeOf(ResizeAction)).call(this, formatter));
19373
+ var ResizeAction$1 = function (_Action) {
19374
+ _inherits(ResizeAction, _Action);
19374
19375
 
19375
- _this.onMouseDown = function (event) {
19376
- if (!(event.target instanceof HTMLElement)) {
19377
- return;
19378
- }
19379
- _this.dragHandle = event.target;
19380
- _this.setCursor(_this.dragHandle.style.cursor);
19376
+ function ResizeAction(formatter) {
19377
+ _classCallCheck(this, ResizeAction);
19381
19378
 
19382
- if (!_this.formatter.currentSpec) {
19383
- return;
19384
- }
19379
+ var _this = _possibleConstructorReturn(this, (ResizeAction.__proto__ || Object.getPrototypeOf(ResizeAction)).call(this, formatter));
19385
19380
 
19386
- var target = _this.formatter.currentSpec.getTargetElement();
19387
- if (!target) {
19388
- return;
19389
- }
19381
+ _this.onMouseDown = function (event) {
19382
+ if (!(event.target instanceof HTMLElement)) {
19383
+ return;
19384
+ }
19385
+ _this.dragHandle = event.target;
19386
+ _this.setCursor(_this.dragHandle.style.cursor);
19390
19387
 
19391
- var rect = target.getBoundingClientRect();
19388
+ if (!_this.formatter.currentSpec) {
19389
+ return;
19390
+ }
19392
19391
 
19393
- _this.dragStartX = event.clientX;
19394
- _this.preDragWidth = rect.width;
19395
- _this.targetRatio = rect.height / rect.width;
19392
+ var target = _this.formatter.currentSpec.getTargetElement();
19393
+ if (!target) {
19394
+ return;
19395
+ }
19396
19396
 
19397
- document.addEventListener('mousemove', _this.onDrag);
19398
- document.addEventListener('mouseup', _this.onMouseUp);
19399
- };
19397
+ var rect = target.getBoundingClientRect();
19400
19398
 
19401
- _this.onDrag = function (event) {
19402
- if (!_this.formatter.currentSpec) {
19403
- return;
19404
- }
19399
+ _this.dragStartX = event.clientX;
19400
+ _this.preDragWidth = rect.width;
19401
+ _this.targetRatio = rect.height / rect.width;
19405
19402
 
19406
- var target = _this.formatter.currentSpec.getTargetElement();
19407
- if (!target) {
19408
- return;
19409
- }
19403
+ document.addEventListener('mousemove', _this.onDrag);
19404
+ document.addEventListener('mouseup', _this.onMouseUp);
19405
+ };
19410
19406
 
19411
- var deltaX = event.clientX - _this.dragStartX;
19412
- var newWidth = 0;
19407
+ _this.onDrag = function (event) {
19408
+ if (!_this.formatter.currentSpec) {
19409
+ return;
19410
+ }
19413
19411
 
19414
- if (_this.dragHandle === _this.topLeftHandle || _this.dragHandle === _this.bottomLeftHandle) {
19415
- newWidth = Math.round(_this.preDragWidth - deltaX);
19416
- } else {
19417
- newWidth = Math.round(_this.preDragWidth + deltaX);
19418
- }
19412
+ var target = _this.formatter.currentSpec.getTargetElement();
19413
+ if (!target) {
19414
+ return;
19415
+ }
19419
19416
 
19420
- var newHeight = _this.targetRatio * newWidth;
19417
+ var deltaX = event.clientX - _this.dragStartX;
19418
+ var newWidth = 0;
19421
19419
 
19422
- target.setAttribute('width', '' + newWidth);
19423
- target.setAttribute('height', '' + newHeight);
19420
+ if (_this.dragHandle === _this.topLeftHandle || _this.dragHandle === _this.bottomLeftHandle) {
19421
+ newWidth = Math.round(_this.preDragWidth - deltaX);
19422
+ } else {
19423
+ newWidth = Math.round(_this.preDragWidth + deltaX);
19424
+ }
19424
19425
 
19425
- _this.formatter.update();
19426
- };
19426
+ var newHeight = _this.targetRatio * newWidth;
19427
19427
 
19428
- _this.onMouseUp = function () {
19429
- _this.setCursor('');
19430
- document.removeEventListener('mousemove', _this.onDrag);
19431
- document.removeEventListener('mouseup', _this.onMouseUp);
19432
- };
19428
+ target.setAttribute('width', '' + newWidth);
19429
+ target.setAttribute('height', '' + newHeight);
19433
19430
 
19434
- _this.topLeftHandle = _this.createHandle('top-left', 'nwse-resize');
19435
- _this.topRightHandle = _this.createHandle('top-right', 'nesw-resize');
19436
- _this.bottomRightHandle = _this.createHandle('bottom-right', 'nwse-resize');
19437
- _this.bottomLeftHandle = _this.createHandle('bottom-left', 'nesw-resize');
19438
- _this.dragHandle = null;
19439
- _this.dragStartX = 0;
19440
- _this.preDragWidth = 0;
19441
- _this.targetRatio = 0;
19442
- return _this;
19443
- }
19431
+ _this.formatter.update();
19432
+ };
19444
19433
 
19445
- _createClass(ResizeAction, [{
19446
- key: 'onCreate',
19447
- value: function onCreate() {
19448
- this.formatter.overlay.appendChild(this.topLeftHandle);
19449
- this.formatter.overlay.appendChild(this.topRightHandle);
19450
- this.formatter.overlay.appendChild(this.bottomRightHandle);
19451
- this.formatter.overlay.appendChild(this.bottomLeftHandle);
19434
+ _this.onMouseUp = function () {
19435
+ _this.setCursor('');
19436
+ document.removeEventListener('mousemove', _this.onDrag);
19437
+ document.removeEventListener('mouseup', _this.onMouseUp);
19438
+ };
19452
19439
 
19453
- this.repositionHandles(this.formatter.options.resize.handleStyle);
19454
- }
19455
- }, {
19456
- key: 'onDestroy',
19457
- value: function onDestroy() {
19458
- this.setCursor('');
19459
- this.formatter.overlay.removeChild(this.topLeftHandle);
19460
- this.formatter.overlay.removeChild(this.topRightHandle);
19461
- this.formatter.overlay.removeChild(this.bottomRightHandle);
19462
- this.formatter.overlay.removeChild(this.bottomLeftHandle);
19463
- }
19464
- }, {
19465
- key: 'createHandle',
19466
- value: function createHandle(position, cursor) {
19467
- var box = document.createElement('div');
19468
- box.classList.add(this.formatter.options.resize.handleClassName);
19469
- box.setAttribute('data-position', position);
19470
- box.style.cursor = cursor;
19471
-
19472
- if (this.formatter.options.resize.handleStyle) {
19473
- Object.assign(box.style, this.formatter.options.resize.handleStyle);
19474
- }
19440
+ _this.topLeftHandle = _this.createHandle('top-left', 'nwse-resize');
19441
+ _this.topRightHandle = _this.createHandle('top-right', 'nesw-resize');
19442
+ _this.bottomRightHandle = _this.createHandle('bottom-right', 'nwse-resize');
19443
+ _this.bottomLeftHandle = _this.createHandle('bottom-left', 'nesw-resize');
19444
+ _this.dragHandle = null;
19445
+ _this.dragStartX = 0;
19446
+ _this.preDragWidth = 0;
19447
+ _this.targetRatio = 0;
19448
+ return _this;
19449
+ }
19475
19450
 
19476
- box.addEventListener('mousedown', this.onMouseDown);
19451
+ _createClass(ResizeAction, [{
19452
+ key: 'onCreate',
19453
+ value: function onCreate() {
19454
+ this.formatter.overlay.appendChild(this.topLeftHandle);
19455
+ this.formatter.overlay.appendChild(this.topRightHandle);
19456
+ this.formatter.overlay.appendChild(this.bottomRightHandle);
19457
+ this.formatter.overlay.appendChild(this.bottomLeftHandle);
19477
19458
 
19478
- return box;
19479
- }
19480
- }, {
19481
- key: 'repositionHandles',
19482
- value: function repositionHandles(handleStyle) {
19483
- var handleXOffset = '0px';
19484
- var handleYOffset = '0px';
19485
- if (handleStyle) {
19486
- if (handleStyle.width) {
19487
- handleXOffset = -parseFloat(handleStyle.width) / 2 + 'px';
19488
- }
19489
- if (handleStyle.height) {
19490
- handleYOffset = -parseFloat(handleStyle.height) / 2 + 'px';
19491
- }
19492
- }
19459
+ this.repositionHandles(this.formatter.options.resize.handleStyle);
19460
+ }
19461
+ }, {
19462
+ key: 'onDestroy',
19463
+ value: function onDestroy() {
19464
+ this.setCursor('');
19465
+ this.formatter.overlay.removeChild(this.topLeftHandle);
19466
+ this.formatter.overlay.removeChild(this.topRightHandle);
19467
+ this.formatter.overlay.removeChild(this.bottomRightHandle);
19468
+ this.formatter.overlay.removeChild(this.bottomLeftHandle);
19469
+ }
19470
+ }, {
19471
+ key: 'createHandle',
19472
+ value: function createHandle(position, cursor) {
19473
+ var box = document.createElement('div');
19474
+ box.classList.add(this.formatter.options.resize.handleClassName);
19475
+ box.setAttribute('data-position', position);
19476
+ box.style.cursor = cursor;
19477
+
19478
+ if (this.formatter.options.resize.handleStyle) {
19479
+ Object.assign(box.style, this.formatter.options.resize.handleStyle);
19480
+ }
19493
19481
 
19494
- Object.assign(this.topLeftHandle.style, { left: handleXOffset, top: handleYOffset });
19495
- Object.assign(this.topRightHandle.style, { right: handleXOffset, top: handleYOffset });
19496
- Object.assign(this.bottomRightHandle.style, { right: handleXOffset, bottom: handleYOffset });
19497
- Object.assign(this.bottomLeftHandle.style, { left: handleXOffset, bottom: handleYOffset });
19498
- }
19499
- }, {
19500
- key: 'setCursor',
19501
- value: function setCursor(value) {
19502
- if (document.body) {
19503
- document.body.style.cursor = value;
19504
- }
19482
+ box.addEventListener('mousedown', this.onMouseDown);
19505
19483
 
19506
- if (this.formatter.currentSpec) {
19507
- var target = this.formatter.currentSpec.getOverlayElement();
19508
- if (target) {
19509
- target.style.cursor = value;
19510
- }
19511
- }
19512
- }
19513
- }]);
19484
+ return box;
19485
+ }
19486
+ }, {
19487
+ key: 'repositionHandles',
19488
+ value: function repositionHandles(handleStyle) {
19489
+ var handleXOffset = '0px';
19490
+ var handleYOffset = '0px';
19491
+ if (handleStyle) {
19492
+ if (handleStyle.width) {
19493
+ handleXOffset = -parseFloat(handleStyle.width) / 2 + 'px';
19494
+ }
19495
+ if (handleStyle.height) {
19496
+ handleYOffset = -parseFloat(handleStyle.height) / 2 + 'px';
19497
+ }
19498
+ }
19514
19499
 
19515
- return ResizeAction;
19516
- }(_Action3.default);
19500
+ Object.assign(this.topLeftHandle.style, { left: handleXOffset, top: handleYOffset });
19501
+ Object.assign(this.topRightHandle.style, { right: handleXOffset, top: handleYOffset });
19502
+ Object.assign(this.bottomRightHandle.style, { right: handleXOffset, bottom: handleYOffset });
19503
+ Object.assign(this.bottomLeftHandle.style, { left: handleXOffset, bottom: handleYOffset });
19504
+ }
19505
+ }, {
19506
+ key: 'setCursor',
19507
+ value: function setCursor(value) {
19508
+ if (document.body) {
19509
+ document.body.style.cursor = value;
19510
+ }
19517
19511
 
19518
- ResizeAction$1.default = ResizeAction;
19512
+ if (this.formatter.currentSpec) {
19513
+ var target = this.formatter.currentSpec.getOverlayElement();
19514
+ if (target) {
19515
+ target.style.cursor = value;
19516
+ }
19517
+ }
19518
+ }
19519
+ }]);
19520
+
19521
+ return ResizeAction;
19522
+ }(_Action3.default);
19523
+
19524
+ ResizeAction.default = ResizeAction$1;
19525
+ return ResizeAction;
19526
+ }
19519
19527
 
19520
19528
  var DeleteAction = {};
19521
19529
 
@@ -19622,7 +19630,7 @@
19622
19630
 
19623
19631
  var _AlignAction2 = _interopRequireDefault(_AlignAction);
19624
19632
 
19625
- var _ResizeAction = ResizeAction$1;
19633
+ var _ResizeAction = requireResizeAction();
19626
19634
 
19627
19635
  var _ResizeAction2 = _interopRequireDefault(_ResizeAction);
19628
19636
 
@@ -20115,7 +20123,7 @@
20115
20123
  }
20116
20124
  });
20117
20125
 
20118
- var _ResizeAction = ResizeAction$1;
20126
+ var _ResizeAction = requireResizeAction();
20119
20127
 
20120
20128
  Object.defineProperty(exports, 'ResizeAction', {
20121
20129
  enumerable: true,
@@ -20275,9 +20283,9 @@
20275
20283
  };
20276
20284
  }
20277
20285
 
20278
- function useCustomLink(editor) {
20286
+ function useCustomLinkClick(editor, initialHandleCustomLink) {
20279
20287
  const quillRef = vue.ref(null);
20280
- const handleCustomLinkRef = vue.ref(null);
20288
+ const handleCustomLinkRef = vue.ref(initialHandleCustomLink || null);
20281
20289
  const handleLinkClick = (event) => {
20282
20290
  if (!quillRef.value || !handleCustomLinkRef.value)
20283
20291
  return;
@@ -20324,43 +20332,12 @@
20324
20332
  const setHandleCustomLink = (fn) => {
20325
20333
  handleCustomLinkRef.value = fn;
20326
20334
  };
20327
- const calculateSelectionPosition = (range) => {
20328
- var _a;
20329
- if (!quillRef.value)
20330
- return { top: 0, left: 0 };
20331
- const selectionRange = range || quillRef.value.getSelection();
20332
- if (!selectionRange || selectionRange.length === 0)
20333
- return { top: 0, left: 0 };
20334
- try {
20335
- const bounds = quillRef.value.getBounds(selectionRange.index, selectionRange.length);
20336
- const editorElement = (_a = editor.value) === null || _a === void 0 ? void 0 : _a.querySelector('.ql-editor');
20337
- const editorContainer = editorElement === null || editorElement === void 0 ? void 0 : editorElement.closest('.quill-editor-container');
20338
- const editorWidth = editorContainer ? editorContainer.clientWidth : ((editorElement === null || editorElement === void 0 ? void 0 : editorElement.clientWidth) || 0);
20339
- const customLinkWidth = 310;
20340
- const maxLeft = editorWidth - customLinkWidth - 16;
20341
- const left = Math.min(bounds.left, Math.max(0, maxLeft));
20342
- const editorRect = editorElement === null || editorElement === void 0 ? void 0 : editorElement.getBoundingClientRect();
20343
- const containerRect = editorContainer === null || editorContainer === void 0 ? void 0 : editorContainer.getBoundingClientRect();
20344
- if (!editorRect || !containerRect) {
20345
- return { top: bounds.top + bounds.height + 5, left: left };
20346
- }
20347
- const editorOffsetTop = editorRect.top - containerRect.top;
20348
- const top = editorOffsetTop + bounds.top + bounds.height + 5;
20349
- return {
20350
- top: top,
20351
- left: left
20352
- };
20353
- }
20354
- catch (error) {
20355
- console.warn('计算选中位置时出错:', error);
20356
- return { top: 0, left: 0 };
20357
- }
20358
- };
20359
20335
  return {
20336
+ quillRef,
20360
20337
  setQuill,
20361
20338
  setHandleCustomLink,
20362
- addLinkClickListener,
20363
- calculateSelectionPosition
20339
+ handleLinkClick,
20340
+ addLinkClickListener
20364
20341
  };
20365
20342
  }
20366
20343
 
@@ -20417,35 +20394,6 @@
20417
20394
  };
20418
20395
  }
20419
20396
 
20420
- const isIPad = () => {
20421
- const ua = navigator.userAgent;
20422
- const isMacOs = /(?:Macintosh)/.test(ua);
20423
- return /(?:iPad|PlayBook)/.test(ua) || (isMacOs && navigator.maxTouchPoints > 1);
20424
- };
20425
-
20426
- function useIPadScene() {
20427
- const isIPadBool = isIPad();
20428
- const handleIPadNewline = (delta, oldContents, clearCallback) => {
20429
- var _a, _b, _c, _d;
20430
- let shouldClearEditor = false;
20431
- const oldText = (_b = (_a = oldContents.ops) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.insert;
20432
- if (!oldText || !((_d = (_c = delta === null || delta === void 0 ? void 0 : delta.ops) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.delete)) {
20433
- return false;
20434
- }
20435
- const deleteLength = delta.ops[0].delete;
20436
- const expectedDeleteLength = oldText.length - 1;
20437
- const hasNewline = JSON.stringify(oldText).includes('\\n');
20438
- shouldClearEditor = deleteLength === expectedDeleteLength && hasNewline;
20439
- if (shouldClearEditor) {
20440
- clearCallback();
20441
- }
20442
- };
20443
- return {
20444
- isIPadBool,
20445
- handleIPadNewline
20446
- };
20447
- }
20448
-
20449
20397
  const boldSVG = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="18" height="18" viewBox="0 0 18 18"><g><g style="opacity:0;"><rect x="0" y="0" width="18" height="18" rx="0" fill="#FFFFFF" fill-opacity="1"/></g><g><path d="M6.794999938146972,7.7800002288818355L9.045000038146974,7.7800002288818355Q9.855000038146972,7.7800002288818355,10.230000038146972,7.442500128881836Q10.605000038146972,7.105000028881836,10.605000038146972,6.505000128881836Q10.605000038146972,6.114999728881836,10.440000038146973,5.860000628881836Q10.275000138146972,5.6050005288818365,9.929999838146973,5.470000228881836Q9.585000038146973,5.335000028881836,9.045000038146974,5.335000028881836L7.139999938146973,5.335000028881836L7.139999938146973,3.385000228881836L9.045000038146974,3.385000228881836Q10.034999838146973,3.385000228881836,10.852499938146973,3.797500608881836Q11.670000038146974,4.2100000388818355,12.142499938146972,4.922500628881836Q12.614999738146974,5.635000228881836,12.614999738146974,6.505000128881836Q12.614999738146974,7.375000028881836,12.142499938146972,8.042500028881836Q11.670000038146974,8.710000028881836,10.860000138146972,9.070000128881837Q10.050000238146973,9.430000328881835,9.045000038146974,9.430000328881835L6.794999938146972,9.430000328881835L6.794999938146972,7.7800002288818355ZM7.139999938146973,12.550000228881835L9.329999938146972,12.550000228881835Q9.900000138146972,12.550000228881835,10.327499838146974,12.354999528881836Q10.755000138146972,12.159999828881835,10.987500238146973,11.807499928881835Q11.219999838146972,11.454999928881836,11.219999838146972,11.020000428881836Q11.219999838146972,10.600000428881836,10.987500238146973,10.232500028881836Q10.755000138146972,9.864999728881836,10.327499838146974,9.647500028881836Q9.900000138146972,9.430000328881835,9.329999938146972,9.430000328881835L6.975000038146972,9.430000328881835L6.975000038146972,7.7800002288818355L9.329999938146972,7.7800002288818355Q10.349999938146972,7.7800002288818355,11.250000038146972,8.200000328881835Q12.149999638146973,8.620000328881837,12.690000538146972,9.362500228881835Q13.229999538146973,10.104999528881836,13.229999538146973,11.034999828881837Q13.229999538146973,11.949999828881836,12.690000538146972,12.752500528881836Q12.149999638146973,13.555000228881836,11.250000038146972,14.027500228881836Q10.349999938146972,14.500000228881836,9.329999938146972,14.500000228881836L7.139999938146973,14.500000228881836L7.139999938146973,12.550000228881835ZM7.064999938146973,14.500000228881836Q6.284999968146972,14.500000228881836,5.872500058146973,14.095000228881837Q5.460000038146973,13.689999228881836,5.460000038146973,12.895000428881836L5.460000038146973,4.989999728881836Q5.460000038146973,4.195000648881836,5.872500058146973,3.789999958881836Q6.284999968146972,3.385000228881836,7.064999938146973,3.385000228881836L7.469999838146973,3.385000228881836L7.469999838146973,14.500000228881836L7.064999938146973,14.500000228881836Z" fill="#555555" fill-opacity="1"/></g></g></svg>`;
20450
20398
  const italicSVG = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="18" height="18" viewBox="0 0 18 18"><g><g style="opacity:0;"><rect x="0" y="0" width="18" height="18" rx="0" fill="#FFFFFF" fill-opacity="1"/></g><g><path d="M8,3Q7.9015086,3,7.8049095,3.019214718Q7.7083106,3.038429435,7.6173165,3.076120459Q7.5263224,3.11381148,7.4444296,3.16853037Q7.3625371,3.2232492600000002,7.2928932,3.2928932Q7.2232492,3.36253715,7.1685302,3.4444297600000002Q7.1138113999999995,3.52632231,7.0761204,3.61731648Q7.0384293,3.70831072,7.0192146,3.80490965Q6.99999994,3.90150857,7,4Q6.99999994,4.0984913,7.0192146,4.1950902Q7.0384293,4.291689,7.0761204,4.3826833Q7.1138113999999995,4.4736774,7.1685302,4.5555699Q7.2232492,4.6374626,7.2928932,4.7071065999999995Q7.3625371,4.7767504,7.4444296,4.8314693Q7.5263224,4.8861883,7.6173165,4.9238794Q7.7083106,4.9615704,7.8049096,4.9807851Q7.9015086,4.9999999,8,5L9.137146,5L8,13L7,13Q6.90150857,13,6.80490965,13.019215Q6.70831072,13.038429,6.6173164799999995,13.07612Q6.52632231,13.113811,6.44442973,13.16853Q6.36253715,13.223249,6.2928932,13.292892Q6.22324926,13.362536,6.16853037,13.444429Q6.11381148,13.526321,6.076120459,13.617315Q6.038429435,13.708309,6.019214718,13.804909Q6,13.901508,6,14Q6,14.098491,6.019214718,14.195089Q6.038429435,14.291689,6.076120459,14.382683Q6.11381148,14.473677,6.16853037,14.555569Q6.22324926,14.637462,6.2928932,14.707106Q6.36253715,14.77675,6.44442976,14.831469Q6.52632231,14.886187,6.6173164799999995,14.923878Q6.70831072,14.961569,6.80490965,14.980784Q6.90150857,15,7,15L11,15Q11.0984912,15,11.1950898,14.980784Q11.2916889,14.961569,11.382682800000001,14.923878Q11.473677200000001,14.886187,11.5555696,14.831469Q11.6374626,14.77675,11.7071066,14.707106Q11.7767506,14.637462,11.8314691,14.555569Q11.8861876,14.473677,11.9238791,14.382683Q11.9615698,14.291689,11.9807849,14.195089Q12,14.098491,12,14Q12,13.901508,11.9807849,13.804909Q11.9615698,13.708309,11.9238791,13.617315Q11.8861876,13.526321,11.8314691,13.444428Q11.7767506,13.362536,11.7071066,13.292892Q11.6374626,13.223249,11.5555701,13.16853Q11.473677200000001,13.113811,11.382682800000001,13.07612Q11.2916889,13.038429,11.1950903,13.019215Q11.0984912,13,11,13L9.8626451,13L11,5L12,5Q12.0984907,4.9999999,12.1950893,4.9807851Q12.2916884,4.9615703,12.382682800000001,4.9238793Q12.4736767,4.8861883,12.5555696,4.8314693Q12.6374621,4.7767504,12.7071061,4.7071065999999995Q12.776750100000001,4.6374626,12.831468600000001,4.5555699Q12.8861876,4.4736774,12.9238787,4.3826833Q12.9615698,4.291689,12.9807849,4.1950902Q12.999999500000001,4.0984913,13,4Q12.999999500000001,3.90150857,12.980784400000001,3.80490965Q12.9615698,3.70831072,12.9238787,3.61731648Q12.8861876,3.52632231,12.8314691,3.44442973Q12.7767506,3.36253715,12.7071066,3.2928932Q12.6374626,3.2232492600000002,12.5555696,3.16853037Q12.4736767,3.11381148,12.382682800000001,3.076120459Q12.2916884,3.038429435,12.1950898,3.019214718Q12.0984907,3,12,3L8,3Z" fill-rule="evenodd" fill="#555555" fill-opacity="1"/></g></g></svg>`;
20451
20399
  const underlineSVG = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="18" height="18" viewBox="0 0 18 18"><g><g style="opacity:0;"><rect x="0" y="0" width="18" height="18" rx="0" fill="#FFFFFF" fill-opacity="1"/></g><g><path d="M5.000117301940918,14.500022450683593L5.000117301940918,14.500022450683593Q5.000117301940918,14.450777450683594,5.009724660740918,14.402477450683593Q5.019332019940918,14.354177450683594,5.038177530940918,14.308679450683593Q5.057023040940918,14.263182450683594,5.084382488940918,14.222236450683594Q5.111741931940918,14.181290450683594,5.146563901940918,14.146469450683593Q5.181385871940918,14.111646450683594,5.222332181940918,14.084286450683594Q5.263278451940918,14.056927450683594,5.308775541940918,14.038082450683595Q5.354272661940918,14.019237450683594,5.402572121940918,14.009630450683593Q5.450871581940918,14.000022450683593,5.500117301940918,14.000022450683593L12.500117301940918,14.000022450683593Q12.549362201940918,14.000022450683593,12.597661501940918,14.009629450683594Q12.645960801940918,14.019237450683594,12.691457701940918,14.038082450683595Q12.736954701940917,14.056926450683594,12.777901601940918,14.084285450683593Q12.818847701940918,14.111645450683593,12.853670101940917,14.146468450683594Q12.888492101940919,14.181289450683593,12.915851601940918,14.222235450683593Q12.943210601940919,14.263181450683593,12.962056201940918,14.308679450683593Q12.980901701940919,14.354177450683594,12.990509501940917,14.402477450683593Q13.00011680194092,14.450777450683594,13.000117301940918,14.500022450683593L13.000117301940918,14.500022450683593Q13.00011680194092,14.549268450683593,12.990509001940918,14.597566450683594Q12.980901701940919,14.645866450683593,12.962056201940918,14.691363450683594Q12.943210601940919,14.736860450683594,12.915851601940918,14.777807450683595Q12.888492101940919,14.818753450683595,12.853670101940917,14.853575450683593Q12.818847701940918,14.888397450683593,12.777901601940918,14.915756450683594Q12.736954701940917,14.943115450683594,12.691457701940918,14.961960450683593Q12.645960801940918,14.980806450683593,12.597661501940918,14.990413450683594Q12.549362201940918,15.000021450683594,12.500117301940918,15.000022450683593L5.500117301940918,15.000022450683593Q5.450871581940918,15.000021450683594,5.402572121940918,14.990414450683593Q5.354272661940918,14.980806450683593,5.308775541940918,14.961960450683593Q5.263278451940918,14.943115450683594,5.222332161940918,14.915756450683594Q5.181385871940918,14.888397450683593,5.146563901940918,14.853574450683594Q5.111741931940918,14.818752450683593,5.084382488940918,14.777806450683594Q5.057023040940918,14.736860450683594,5.038177530940918,14.691363450683594Q5.019332019940918,14.645866450683593,5.009724660740918,14.597567450683593Q5.000117301940918,14.549268450683593,5.000117301940918,14.500022450683593ZM5.045039176940918,3.548906330683594Q5.045039176940918,3.1015625006835936,5.283039211940918,2.8637809706835937Q5.521039131940918,2.6259994506835938,5.969039081940918,2.6259994506835938L5.997039201940918,2.6259994506835938Q6.445039201940918,2.6259994506835938,6.6830393019409176,2.8637809706835937Q6.921039201940918,3.1015625006835936,6.921039201940918,3.548906330683594L6.921039201940918,9.010000250683593Q6.921039201940918,9.737999950683594,7.180039401940919,10.255999550683594Q7.439039201940918,10.774000150683595,7.908039101940918,11.053999950683593Q8.377039001940918,11.333999650683594,8.993039101940917,11.333999650683594Q9.609039301940918,11.333999650683594,10.085039101940918,11.060999850683594Q10.561039401940917,10.788000150683594,10.820039301940918,10.263000450683593Q11.079039101940918,9.737999950683594,11.079039101940918,9.010000250683593L11.079039101940918,3.548906330683594Q11.079039101940918,3.1015625006835936,11.317039501940918,2.8637809706835937Q11.555039401940917,2.6259994506835938,12.003039401940917,2.6259994506835938L12.031039201940917,2.6259994506835938Q12.479039201940918,2.6259994506835938,12.717039101940918,2.8637809706835937Q12.955039001940918,3.1015625006835936,12.955039001940918,3.548906330683594L12.955039001940918,9.010000250683593Q12.955039001940918,10.144000050683594,12.416039501940919,11.095999750683594Q11.877039901940918,12.048000350683594,10.967039101940918,12.600999850683595Q10.057039301940918,13.154000450683593,8.993039101940917,13.154000450683593Q7.929039001940918,13.154000450683593,7.0190392019409185,12.600999850683595Q6.109039201940918,12.048000350683594,5.577039361940918,11.095999750683594Q5.045039176940918,10.144000050683594,5.045039176940918,9.010000250683593L5.045039176940918,3.548906330683594Z" fill="#555555" fill-opacity="1"/></g></g></svg>`;
@@ -20460,6 +20408,12 @@
20460
20408
  const imageSVG = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1" width="18" height="18" viewBox="0 0 18 18"><g><g style="opacity:0;"><rect x="0" y="0" width="18" height="18" rx="0" fill="#FFFFFF" fill-opacity="1"/></g><g><path d="M1.87471507,3.83578219Q1.5,4.18540478,1.5,4.6875L1.5,14.312503Q1.50000006,14.814598,1.874716,15.16422Q2.23459671,15.5,2.73684216,15.5L15.263157,15.5Q15.765403,15.5,16.125284,15.164218Q16.499999000000003,14.814597,16.499999000000003,14.312501L16.499999000000003,4.6875Q16.499999000000003,4.18540342,16.125284999999998,3.83578214Q15.765404,3.5,15.263157,3.5L2.73684216,3.5Q2.23459646,3.5,1.87471507,3.83578219ZM2.5,14.312503L2.5,4.6875Q2.5,4.5,2.73684216,4.5L15.263157,4.5Q15.5,4.5,15.5,4.6875L15.5,14.312501Q15.5,14.5,15.263157,14.5L2.73684216,14.5Q2.5,14.5,2.5,14.312503Z" fill-rule="evenodd" fill="#555555" fill-opacity="1" style="mix-blend-mode:passthrough"/></g><g><ellipse cx="5.4375" cy="7.4375" rx="0.4375" ry="0.4375" fill-opacity="0" stroke-opacity="1" stroke="#555555" fill="none" stroke-width="1" stroke-linecap="ROUND" stroke-linejoin="round" style="mix-blend-mode:passthrough"/></g><g><path d="M5.9053998,9.924615948146972L1.7143693,12.841608238146973Q1.61364189,12.911715538146973,1.55682093,13.020492338146973Q1.5,13.129269138146974,1.5,13.251992238146972L1.50000003,14.418008338146972Q1.50000003,14.876594038146973,1.84130602,15.195924738146973Q2.16843581,15.501991738146973,2.62437022,15.501991738146973L15.375628,15.501991738146973Q15.831564,15.501991738146973,16.158693,15.195924738146973Q16.5,14.876594038146973,16.5,14.418007838146973L16.5,13.251992238146972Q16.500000999999997,13.186988838146974,16.48338,13.124146438146973Q16.466759,13.061303638146972,16.434621,13.004799838146972Q16.402485,12.948296338146973,16.356969,12.901887938146972Q16.311453,12.855479738146972,16.255583,12.822251838146972L9.8796926,9.030259398146972Q9.842938400000001,9.008400078146973,9.8030057,8.993099628146974Q9.763073,8.977799118146972,9.721121799999999,8.969501908146972Q9.6791716,8.961204618146972,9.6364217,8.960151608146973Q9.5936708,8.959098578146973,9.551362000000001,8.965320438146973Q9.5090542,8.971542238146972,9.4684162,8.984858218146973Q9.427778199999999,8.998174158146973,9.3899918,9.018197478146973Q9.352206200000001,9.038220708146973,9.3183689,9.064369648146972Q9.284532500000001,9.090518598146973,9.2556267,9.122033748146972L7.6887164,10.830422738146973L6.4904227,9.934544588146972Q6.4273362,9.887379288146972,6.3528042,9.861893948146973Q6.2782726,9.836408678146972,6.1995153,9.835072038146972Q6.1207581,9.833735408146973,6.045404,9.856676968146973Q5.9700503000000005,9.879618528146972,5.9053998,9.924615948146972ZM2.5,13.513173138146973L2.50000006,14.418008338146972Q2.50000006,14.501992238146972,2.62437022,14.501992238146972L15.375628,14.501992238146972Q15.5,14.501992238146972,15.5,14.418007838146973L15.5,13.536368338146973L9.7178593,10.097503488146973L8.1200023,11.839632738146973Q8.0888524,11.873595438146973,8.052019600000001,11.901292338146973Q8.0151863,11.928988938146972,7.9739118,11.949486538146973Q7.9326363,11.969984038146972,7.88831,11.982591638146973Q7.8439837,11.995199238146974,7.7980995,11.999492138146973Q7.7522154,12.003785338146972,7.7063198,11.999619238146973Q7.6604242,11.995453338146973,7.6160631,11.982968338146973Q7.571702,11.970483338146973,7.5303702,11.950099938146973Q7.4890385,11.929716538146973,7.4521289,11.902122038146972L6.1805682,10.951467238146973L2.5,13.513173138146973Z" fill-rule="evenodd" fill="#555555" fill-opacity="1" style="mix-blend-mode:passthrough"/></g></g></svg>`;
20461
20409
  const colorSVG = `<svg t="1757558810758" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9036" width="20" height="19"><path d="M170.666667 796.444444m42.666666 0l597.333334 0q42.666667 0 42.666666 42.666667l0 0q0 42.666667-42.666666 42.666667l-597.333334 0q-42.666667 0-42.666666-42.666667l0 0q0-42.666667 42.666666-42.666667Z" fill="#999999" p-id="9037" data-spm-anchor-id="a313x.manage_type_myprojects.0.i1.62d43a81huHZ4F" class="selected"></path><path d="M756.565333 676.579556q8.760889 24.689778-3.185777 43.804444t-38.229334 19.114667h-3.185778q-26.282667 0-41.813333-15.530667-15.530667-15.530667-25.884444-45.795556L489.756444 252.871111h44.600889l-154.510222 425.301333q-11.150222 30.264889-25.884444 45.795556-14.791111 15.530667-41.813334 15.530667H308.906667q-25.486222 0-37.831111-19.114667-12.344889-19.114667-3.584-43.804444l175.217777-481.052445q17.521778-46.193778 68.494223-46.193778h1.592888q50.972444 0 68.494223 46.193778l175.217777 481.052445zM643.413333 484.636444v103.537778H380.586667v-103.537778h262.826666z" fill="#555555" p-id="9038" data-spm-anchor-id="a313x.manage_type_myprojects.0.i0.62d43a81huHZ4F" class="selected"></path></svg>`;
20462
20410
 
20411
+ const isIPad = () => {
20412
+ const ua = navigator.userAgent;
20413
+ const isMacOs = /(?:Macintosh)/.test(ua);
20414
+ return /(?:iPad|PlayBook)/.test(ua) || (isMacOs && navigator.maxTouchPoints > 1);
20415
+ };
20416
+
20463
20417
  const QuillEditor = vue.defineComponent({
20464
20418
  name: 'QuillEditor',
20465
20419
  inheritAttrs: false,
@@ -20472,7 +20426,7 @@
20472
20426
  },
20473
20427
  contentType: {
20474
20428
  type: String,
20475
- default: 'delta',
20429
+ default: 'html',
20476
20430
  validator: (value) => {
20477
20431
  return ['delta', 'html', 'text'].includes(value);
20478
20432
  },
@@ -20553,9 +20507,8 @@
20553
20507
  const linkPosition = vue.ref({ top: 0, left: 0 });
20554
20508
  const savedRange = vue.ref(null);
20555
20509
  const { addClickHandler } = useGlobalClick(props.clickTargetSelector);
20556
- const { isIPadBool, handleIPadNewline } = useIPadScene();
20557
20510
  const { setQuill, handleBlotFormatterClick, configureBlotFormatter, applyImageStyle, registerBlotFormatter, getBlotFormatterConfig } = useBlotFormatter(editor, props.enableImageResize);
20558
- const { setQuill: setLinkQuill, setHandleCustomLink, addLinkClickListener, calculateSelectionPosition } = useCustomLink(editor);
20511
+ const { setQuill: setLinkQuill, setHandleCustomLink, addLinkClickListener } = useCustomLinkClick(editor);
20559
20512
  vue.onMounted(() => {
20560
20513
  initialize();
20561
20514
  });
@@ -20607,7 +20560,7 @@
20607
20560
  icons['image'] = imageSVG;
20608
20561
  icons.list.ordered = listOrderedSVG;
20609
20562
  icons.list.bullet = listBulletSVG;
20610
- if (isIPadBool)
20563
+ if (isIPad())
20611
20564
  (icons['color'] = colorSVG);
20612
20565
  }
20613
20566
  }
@@ -20680,6 +20633,8 @@
20680
20633
  quill.on('text-change', handleTextChange);
20681
20634
  quill.on('selection-change', handleSelectionChange);
20682
20635
  quill.on('editor-change', handleEditorChange);
20636
+ quill.on('text-change', updateHistoryState);
20637
+ quill.on('selection-change', updateHistoryState);
20683
20638
  addLinkClickListener();
20684
20639
  const toolbarClickHandler = (event) => {
20685
20640
  var _a;
@@ -20833,32 +20788,6 @@
20833
20788
  return Object.values(delta.ops).some((v) => !v.retain || Object.keys(v).length !== 1);
20834
20789
  };
20835
20790
  let internalModel;
20836
- const processHTMLContent = (html, quill) => {
20837
- if (/^<p><br\/?>(.+?)<\/p>$/.test(html)) {
20838
- const match = html.match(/^<p><br\/?>(.+?)<\/p>$/);
20839
- if (match && match[1]) {
20840
- const processedHtml = `<p>${match[1]}</p>`;
20841
- if (quill) {
20842
- quill.root.innerHTML = processedHtml;
20843
- }
20844
- return processedHtml;
20845
- }
20846
- else {
20847
- return maybeClone(getContents());
20848
- }
20849
- }
20850
- else {
20851
- if (html === '' ||
20852
- html === '<p><br></p>' ||
20853
- html === '<p></p>' ||
20854
- html === '<p><br/></p>') {
20855
- return '';
20856
- }
20857
- else {
20858
- return maybeClone(getContents());
20859
- }
20860
- }
20861
- };
20862
20791
  const internalModelEquals = (against) => {
20863
20792
  if (typeof internalModel === typeof against) {
20864
20793
  if (against === internalModel) {
@@ -20876,13 +20805,15 @@
20876
20805
  return false;
20877
20806
  };
20878
20807
  const handleTextChange = (delta, oldContents, source) => {
20808
+ var _a;
20879
20809
  if (props.contentType === 'html') {
20880
- const html = getHTML();
20881
- internalModel = processHTMLContent(html, quill);
20882
- if (isIPadBool) {
20883
- handleIPadNewline(delta, oldContents, () => {
20884
- setContents('', 'api');
20885
- internalModel = '';
20810
+ const rawHTML = (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
20811
+ internalModel = getHTML();
20812
+ if (internalModel && internalModel !== rawHTML) {
20813
+ vue.nextTick(() => {
20814
+ if (quill && quill.root.innerHTML !== internalModel && typeof internalModel === 'string') {
20815
+ quill.root.innerHTML = internalModel;
20816
+ }
20886
20817
  });
20887
20818
  }
20888
20819
  }
@@ -20896,7 +20827,13 @@
20896
20827
  applyImageStyle();
20897
20828
  });
20898
20829
  ctx.emit('textChange', { delta, oldContents, source });
20899
- updateHistoryState();
20830
+ };
20831
+ const observeTooltip = () => {
20832
+ const preview = document.querySelector('.ql-preview');
20833
+ if (!preview)
20834
+ return;
20835
+ preview.setAttribute('href', 'javascript:void(0)');
20836
+ preview.setAttribute('target', '_self');
20900
20837
  };
20901
20838
  const controlToolbarVisible = (visible) => {
20902
20839
  var _a;
@@ -20909,13 +20846,13 @@
20909
20846
  };
20910
20847
  const isEditorFocus = vue.ref();
20911
20848
  const handleSelectionChange = (range, oldRange, source) => {
20849
+ observeTooltip();
20912
20850
  isEditorFocus.value = !!(quill === null || quill === void 0 ? void 0 : quill.hasFocus());
20913
20851
  canUseLink.value = !!(range && range.length > 0);
20914
20852
  if (isEditorFocus.value) {
20915
20853
  controlToolbarVisible(true);
20916
20854
  }
20917
20855
  ctx.emit('selectionChange', { range, oldRange, source });
20918
- updateHistoryState();
20919
20856
  };
20920
20857
  vue.watch(isEditorFocus, (focus) => {
20921
20858
  if (focus)
@@ -20939,6 +20876,19 @@
20939
20876
  source: args[3],
20940
20877
  });
20941
20878
  };
20879
+ const getEditor = () => {
20880
+ return editor.value;
20881
+ };
20882
+ const getToolbar = () => {
20883
+ var _a;
20884
+ return (_a = quill === null || quill === void 0 ? void 0 : quill.getModule('toolbar')) === null || _a === void 0 ? void 0 : _a.container;
20885
+ };
20886
+ const getQuill = () => {
20887
+ if (quill)
20888
+ return quill;
20889
+ else
20890
+ throw `The quill editor hasn't been instantiated`;
20891
+ };
20942
20892
  const getContents = (index, length) => {
20943
20893
  if (props.contentType === 'html') {
20944
20894
  return getHTML();
@@ -20949,14 +20899,20 @@
20949
20899
  return quill === null || quill === void 0 ? void 0 : quill.getContents(index, length);
20950
20900
  };
20951
20901
  const setContents = (content, source = 'api') => {
20952
- var _a;
20953
20902
  const normalizedContent = !content
20954
20903
  ? props.contentType === 'delta'
20955
20904
  ? new Delta$1()
20956
20905
  : ''
20957
20906
  : content;
20958
20907
  if (props.contentType === 'html') {
20959
- setHTML((_a = normalizedContent) !== null && _a !== void 0 ? _a : '');
20908
+ if (!normalizedContent || normalizedContent === '') {
20909
+ if (quill) {
20910
+ quill.root.innerHTML = '';
20911
+ }
20912
+ }
20913
+ else {
20914
+ setHTML(normalizedContent);
20915
+ }
20960
20916
  }
20961
20917
  else if (props.contentType === 'text') {
20962
20918
  setText(normalizedContent, source);
@@ -20976,22 +20932,31 @@
20976
20932
  const getHTML = () => {
20977
20933
  var _a;
20978
20934
  let html = (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
20935
+ if (html === '<p><br></p>' ||
20936
+ html === '<p></p>' ||
20937
+ html === '<p><br/></p>' ||
20938
+ html === '<p><br><br></p>') {
20939
+ return '';
20940
+ }
20979
20941
  if (/^<p><br\/?>(.+?)<\/p>$/.test(html)) {
20980
20942
  const match = html.match(/^<p><br\/?>(.+?)<\/p>$/);
20981
20943
  if (match && match[1]) {
20982
20944
  html = `<p>${match[1]}</p>`;
20983
20945
  }
20984
20946
  }
20985
- if (html === '<p><br></p>' ||
20986
- html === '<p></p>' ||
20987
- html === '<p><br/></p>') {
20988
- html = '';
20989
- }
20990
20947
  return html;
20991
20948
  };
20992
20949
  const setHTML = (html) => {
20993
- if (quill)
20950
+ if (quill) {
20994
20951
  quill.root.innerHTML = html;
20952
+ if (html && !html.includes('<br>')) {
20953
+ vue.nextTick(() => {
20954
+ if (quill && quill.root.innerHTML !== html) {
20955
+ quill.root.innerHTML = html;
20956
+ }
20957
+ });
20958
+ }
20959
+ }
20995
20960
  };
20996
20961
  const pasteHTML = (html, source = 'api') => {
20997
20962
  const delta = quill === null || quill === void 0 ? void 0 : quill.clipboard.convert(html);
@@ -21036,6 +21001,38 @@
21036
21001
  handleCustomLink(true);
21037
21002
  }
21038
21003
  };
21004
+ const calculateSelectionPosition = (range) => {
21005
+ var _a;
21006
+ if (!quill)
21007
+ return { top: 0, left: 0 };
21008
+ const selectionRange = range || quill.getSelection();
21009
+ if (!selectionRange || selectionRange.length === 0)
21010
+ return { top: 0, left: 0 };
21011
+ try {
21012
+ const bounds = quill.getBounds(selectionRange.index, selectionRange.length);
21013
+ const editorElement = (_a = editor.value) === null || _a === void 0 ? void 0 : _a.querySelector('.ql-editor');
21014
+ const editorContainer = editorElement === null || editorElement === void 0 ? void 0 : editorElement.closest('.quill-editor-container');
21015
+ const editorWidth = editorContainer ? editorContainer.clientWidth : ((editorElement === null || editorElement === void 0 ? void 0 : editorElement.clientWidth) || 0);
21016
+ const customLinkWidth = 310;
21017
+ const maxLeft = editorWidth - customLinkWidth - 16;
21018
+ const left = Math.min(bounds.left, Math.max(0, maxLeft));
21019
+ const editorRect = editorElement === null || editorElement === void 0 ? void 0 : editorElement.getBoundingClientRect();
21020
+ const containerRect = editorContainer === null || editorContainer === void 0 ? void 0 : editorContainer.getBoundingClientRect();
21021
+ if (!editorRect || !containerRect) {
21022
+ return { top: bounds.top + bounds.height + 5, left: left };
21023
+ }
21024
+ const editorOffsetTop = editorRect.top - containerRect.top;
21025
+ const top = editorOffsetTop + bounds.top + bounds.height + 5;
21026
+ return {
21027
+ top: top,
21028
+ left: left
21029
+ };
21030
+ }
21031
+ catch (error) {
21032
+ console.warn('计算选中位置时出错:', error);
21033
+ return { top: 0, left: 0 };
21034
+ }
21035
+ };
21039
21036
  const handleCustomLink = (bool, linkInfo) => {
21040
21037
  if (!quill)
21041
21038
  return;
@@ -21128,6 +21125,9 @@
21128
21125
  linkUrl,
21129
21126
  linkText,
21130
21127
  linkPosition,
21128
+ getEditor,
21129
+ getToolbar,
21130
+ getQuill,
21131
21131
  getContents,
21132
21132
  setContents,
21133
21133
  getHTML,