@tiptap/vue-2 3.4.2 → 3.4.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.
@@ -1635,6 +1635,7 @@ var BubbleMenuView = class {
1635
1635
  resizeDelay = 60,
1636
1636
  shouldShow,
1637
1637
  appendTo,
1638
+ getReferencedVirtualElement,
1638
1639
  options
1639
1640
  }) {
1640
1641
  this.preventHide = false;
@@ -1733,6 +1734,7 @@ var BubbleMenuView = class {
1733
1734
  this.resizeDelay = resizeDelay;
1734
1735
  this.appendTo = appendTo;
1735
1736
  this.scrollTarget = (_a = options == null ? void 0 : options.scrollTarget) != null ? _a : window;
1737
+ this.getReferencedVirtualElement = getReferencedVirtualElement;
1736
1738
  this.floatingUIOptions = {
1737
1739
  ...this.floatingUIOptions,
1738
1740
  ...options
@@ -1790,8 +1792,13 @@ var BubbleMenuView = class {
1790
1792
  }
1791
1793
  return middlewares;
1792
1794
  }
1793
- updatePosition() {
1795
+ get virtualElement() {
1796
+ var _a;
1794
1797
  const { selection } = this.editor.state;
1798
+ const referencedVirtualElement = (_a = this.getReferencedVirtualElement) == null ? void 0 : _a.call(this);
1799
+ if (referencedVirtualElement) {
1800
+ return referencedVirtualElement;
1801
+ }
1795
1802
  const domRect = (0, import_core3.posToDOMRect)(this.view, selection.from, selection.to);
1796
1803
  let virtualElement = {
1797
1804
  getBoundingClientRect: () => domRect,
@@ -1828,6 +1835,13 @@ var BubbleMenuView = class {
1828
1835
  getClientRects: () => [clientRect]
1829
1836
  };
1830
1837
  }
1838
+ return virtualElement;
1839
+ }
1840
+ updatePosition() {
1841
+ const virtualElement = this.virtualElement;
1842
+ if (!virtualElement) {
1843
+ return;
1844
+ }
1831
1845
  computePosition2(virtualElement, this.element, {
1832
1846
  placement: this.floatingUIOptions.placement,
1833
1847
  strategy: this.floatingUIOptions.strategy,
@@ -1938,6 +1952,7 @@ var BubbleMenu = import_core2.Extension.create({
1938
1952
  updateDelay: this.options.updateDelay,
1939
1953
  options: this.options.options,
1940
1954
  appendTo: this.options.appendTo,
1955
+ getReferencedVirtualElement: this.options.getReferencedVirtualElement,
1941
1956
  shouldShow: this.options.shouldShow
1942
1957
  })
1943
1958
  ];
@@ -1991,7 +2006,8 @@ var BubbleMenu2 = {
1991
2006
  editor,
1992
2007
  element: this.$el,
1993
2008
  pluginKey: this.pluginKey,
1994
- shouldShow: this.shouldShow
2009
+ shouldShow: this.shouldShow,
2010
+ getReferencedVirtualElement: this.getReferencedVirtualElement
1995
2011
  })
1996
2012
  );
1997
2013
  });