@tiptap/vue-2 3.6.1 → 3.6.3

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.
@@ -56,7 +56,7 @@ interface BubbleMenuPluginProps {
56
56
  * @type {HTMLElement}
57
57
  * @default null
58
58
  */
59
- appendTo?: HTMLElement;
59
+ appendTo?: HTMLElement | (() => HTMLElement);
60
60
  /**
61
61
  * A function that returns the virtual element for the menu.
62
62
  * This is useful when the menu needs to be positioned relative to a specific DOM element.
@@ -130,7 +130,7 @@ interface FloatingMenuPluginProps {
130
130
  * @type {HTMLElement}
131
131
  * @default null
132
132
  */
133
- appendTo?: HTMLElement;
133
+ appendTo?: HTMLElement | (() => HTMLElement);
134
134
  /**
135
135
  * A function that determines whether the menu should be shown or not.
136
136
  * If this function returns `false`, the menu will be hidden, otherwise it will be shown.
@@ -56,7 +56,7 @@ interface BubbleMenuPluginProps {
56
56
  * @type {HTMLElement}
57
57
  * @default null
58
58
  */
59
- appendTo?: HTMLElement;
59
+ appendTo?: HTMLElement | (() => HTMLElement);
60
60
  /**
61
61
  * A function that returns the virtual element for the menu.
62
62
  * This is useful when the menu needs to be positioned relative to a specific DOM element.
@@ -130,7 +130,7 @@ interface FloatingMenuPluginProps {
130
130
  * @type {HTMLElement}
131
131
  * @default null
132
132
  */
133
- appendTo?: HTMLElement;
133
+ appendTo?: HTMLElement | (() => HTMLElement);
134
134
  /**
135
135
  * A function that determines whether the menu should be shown or not.
136
136
  * If this function returns `false`, the menu will be hidden, otherwise it will be shown.
@@ -1660,6 +1660,10 @@ var BubbleMenuView = class {
1660
1660
  };
1661
1661
  this.blurHandler = ({ event }) => {
1662
1662
  var _a2;
1663
+ if (this.editor.isDestroyed) {
1664
+ this.destroy();
1665
+ return;
1666
+ }
1663
1667
  if (this.preventHide) {
1664
1668
  this.preventHide = false;
1665
1669
  return;
@@ -1866,13 +1870,14 @@ var BubbleMenuView = class {
1866
1870
  return shouldShow;
1867
1871
  }
1868
1872
  show() {
1869
- var _a, _b;
1873
+ var _a;
1870
1874
  if (this.isVisible) {
1871
1875
  return;
1872
1876
  }
1873
1877
  this.element.style.visibility = "visible";
1874
1878
  this.element.style.opacity = "1";
1875
- (_b = (_a = this.appendTo) != null ? _a : this.view.dom.parentElement) == null ? void 0 : _b.appendChild(this.element);
1879
+ const appendToElement = typeof this.appendTo === "function" ? this.appendTo() : this.appendTo;
1880
+ (_a = appendToElement != null ? appendToElement : this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
1876
1881
  if (this.floatingUIOptions.onShow) {
1877
1882
  this.floatingUIOptions.onShow();
1878
1883
  }
@@ -2177,13 +2182,14 @@ var FloatingMenuView = class {
2177
2182
  this.updateHandler(view, selectionChanged, docChanged, oldState);
2178
2183
  }
2179
2184
  show() {
2180
- var _a, _b;
2185
+ var _a;
2181
2186
  if (this.isVisible) {
2182
2187
  return;
2183
2188
  }
2184
2189
  this.element.style.visibility = "visible";
2185
2190
  this.element.style.opacity = "1";
2186
- (_b = (_a = this.appendTo) != null ? _a : this.view.dom.parentElement) == null ? void 0 : _b.appendChild(this.element);
2191
+ const appendToElement = typeof this.appendTo === "function" ? this.appendTo() : this.appendTo;
2192
+ (_a = appendToElement != null ? appendToElement : this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
2187
2193
  if (this.floatingUIOptions.onShow) {
2188
2194
  this.floatingUIOptions.onShow();
2189
2195
  }