pxx-vue-quill 1.0.154 → 1.0.156

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-11T17:29:53.432Z
10
+ * Date: 2025-09-11T18:58:11.254Z
11
11
  */
12
12
  (function (global, factory) {
13
13
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
@@ -20547,7 +20547,6 @@
20547
20547
  try {
20548
20548
  const icons = Quill.import('ui/icons');
20549
20549
  if (icons) {
20550
- console.log(icons);
20551
20550
  icons['bold'] = boldSVG;
20552
20551
  icons['italic'] = italicSVG;
20553
20552
  icons['underline'] = underlineSVG;
@@ -20790,6 +20789,7 @@
20790
20789
  };
20791
20790
  let internalModel;
20792
20791
  const internalModelEquals = (against) => {
20792
+ console.log("against---------", against, internalModel);
20793
20793
  if (typeof internalModel === typeof against) {
20794
20794
  if (against === internalModel) {
20795
20795
  return true;
@@ -20798,23 +20798,44 @@
20798
20798
  against &&
20799
20799
  typeof internalModel === 'object' &&
20800
20800
  internalModel) {
20801
- return !deltaHasValuesOtherThanRetain(internalModel.diff(against));
20801
+ const diff = internalModel.diff(against);
20802
+ const hasValues = deltaHasValuesOtherThanRetain(diff);
20803
+ return !hasValues;
20802
20804
  }
20803
20805
  }
20804
20806
  return false;
20805
20807
  };
20806
20808
  const handleTextChange = (delta, oldContents, source) => {
20807
- internalModel = maybeClone(getContents());
20808
20809
  if (props.contentType === 'html') {
20809
- const html = getHTML();
20810
- if (html === '' ||
20811
- html === '<p><br></p>' ||
20812
- html === '<p></p>' ||
20813
- html === '<p><br/></p>' ||
20814
- /^<p><br\/?>\s*<\/p>$/.test(html)) {
20815
- internalModel = '';
20810
+ let html = getHTML();
20811
+ if (/^<p><br\/?>(.+?)<\/p>$/.test(html)) {
20812
+ const match = html.match(/^<p><br\/?>(.+?)<\/p>$/);
20813
+ if (match && match[1]) {
20814
+ html = `<p>${match[1]}</p>`;
20815
+ if (quill) {
20816
+ quill.root.innerHTML = html;
20817
+ }
20818
+ internalModel = html;
20819
+ }
20820
+ else {
20821
+ internalModel = maybeClone(getContents());
20822
+ }
20823
+ }
20824
+ else {
20825
+ if (html === '' ||
20826
+ html === '<p><br></p>' ||
20827
+ html === '<p></p>' ||
20828
+ html === '<p><br/></p>') {
20829
+ internalModel = '';
20830
+ }
20831
+ else {
20832
+ internalModel = maybeClone(getContents());
20833
+ }
20816
20834
  }
20817
20835
  }
20836
+ else {
20837
+ internalModel = maybeClone(getContents());
20838
+ }
20818
20839
  if (!internalModelEquals(props.content)) {
20819
20840
  ctx.emit('update:content', internalModel);
20820
20841
  }
@@ -20926,12 +20947,17 @@
20926
20947
  };
20927
20948
  const getHTML = () => {
20928
20949
  var _a;
20929
- const html = (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
20950
+ let html = (_a = quill === null || quill === void 0 ? void 0 : quill.root.innerHTML) !== null && _a !== void 0 ? _a : '';
20951
+ if (/^<p><br\/?>(.+?)<\/p>$/.test(html)) {
20952
+ const match = html.match(/^<p><br\/?>(.+?)<\/p>$/);
20953
+ if (match && match[1]) {
20954
+ html = `<p>${match[1]}</p>`;
20955
+ }
20956
+ }
20930
20957
  if (html === '<p><br></p>' ||
20931
20958
  html === '<p></p>' ||
20932
- html === '<p><br/></p>' ||
20933
- /^<p><br\/?>\s*<\/p>$/.test(html)) {
20934
- return '';
20959
+ html === '<p><br/></p>') {
20960
+ html = '';
20935
20961
  }
20936
20962
  return html;
20937
20963
  };
@@ -21083,7 +21109,7 @@
21083
21109
  savedRange.value = null;
21084
21110
  };
21085
21111
  vue.watch(() => props.content, (newContent) => {
21086
- if (!quill || internalModelEquals(newContent))
21112
+ if (!quill)
21087
21113
  return;
21088
21114
  const selection = quill.getSelection();
21089
21115
  if (selection) {