@tiptap/vue-2 3.0.0-beta.11 → 3.0.0-beta.14

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.
@@ -1587,6 +1587,18 @@ var computePosition2 = (reference, floating, options) => {
1587
1587
  // ../extension-bubble-menu/dist/index.js
1588
1588
  import { isTextSelection, posToDOMRect } from "@tiptap/core";
1589
1589
  import { Plugin, PluginKey } from "@tiptap/pm/state";
1590
+ import { CellSelection } from "@tiptap/pm/tables";
1591
+ function combineDOMRects(rect1, rect2) {
1592
+ const top = Math.min(rect1.top, rect2.top);
1593
+ const bottom = Math.max(rect1.bottom, rect2.bottom);
1594
+ const left = Math.min(rect1.left, rect2.left);
1595
+ const right = Math.max(rect1.right, rect2.right);
1596
+ const width = right - left;
1597
+ const height = bottom - top;
1598
+ const x = left;
1599
+ const y = top;
1600
+ return new DOMRect(x, y, width, height);
1601
+ }
1590
1602
  var BubbleMenuView = class {
1591
1603
  constructor({
1592
1604
  editor,
@@ -1745,9 +1757,26 @@ var BubbleMenuView = class {
1745
1757
  }
1746
1758
  updatePosition() {
1747
1759
  const { selection } = this.editor.state;
1748
- const virtualElement = {
1760
+ let virtualElement = {
1749
1761
  getBoundingClientRect: () => posToDOMRect(this.view, selection.from, selection.to)
1750
1762
  };
1763
+ if (selection instanceof CellSelection) {
1764
+ const { $anchorCell, $headCell } = selection;
1765
+ const from = $anchorCell ? $anchorCell.pos : $headCell.pos;
1766
+ const to = $headCell ? $headCell.pos : $anchorCell.pos;
1767
+ const fromDOM = this.view.nodeDOM(from);
1768
+ const toDOM = this.view.nodeDOM(to);
1769
+ if (!fromDOM || !toDOM) {
1770
+ return;
1771
+ }
1772
+ const clientRect = fromDOM === toDOM ? fromDOM.getBoundingClientRect() : combineDOMRects(
1773
+ fromDOM.getBoundingClientRect(),
1774
+ toDOM.getBoundingClientRect()
1775
+ );
1776
+ virtualElement = {
1777
+ getBoundingClientRect: () => clientRect
1778
+ };
1779
+ }
1751
1780
  computePosition2(virtualElement, this.element, {
1752
1781
  placement: this.floatingUIOptions.placement,
1753
1782
  strategy: this.floatingUIOptions.strategy,