@tiptap/vue-2 3.0.0-beta.11 → 3.0.0-beta.12
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.
- package/dist/menus/index.cjs +30 -1
- package/dist/menus/index.cjs.map +1 -1
- package/dist/menus/index.js +30 -1
- package/dist/menus/index.js.map +1 -1
- package/package.json +7 -7
package/dist/menus/index.cjs
CHANGED
|
@@ -1614,6 +1614,18 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
1614
1614
|
// ../extension-bubble-menu/dist/index.js
|
|
1615
1615
|
var import_core3 = require("@tiptap/core");
|
|
1616
1616
|
var import_state = require("@tiptap/pm/state");
|
|
1617
|
+
var import_tables = require("@tiptap/pm/tables");
|
|
1618
|
+
function combineDOMRects(rect1, rect2) {
|
|
1619
|
+
const top = Math.min(rect1.top, rect2.top);
|
|
1620
|
+
const bottom = Math.max(rect1.bottom, rect2.bottom);
|
|
1621
|
+
const left = Math.min(rect1.left, rect2.left);
|
|
1622
|
+
const right = Math.max(rect1.right, rect2.right);
|
|
1623
|
+
const width = right - left;
|
|
1624
|
+
const height = bottom - top;
|
|
1625
|
+
const x = left;
|
|
1626
|
+
const y = top;
|
|
1627
|
+
return new DOMRect(x, y, width, height);
|
|
1628
|
+
}
|
|
1617
1629
|
var BubbleMenuView = class {
|
|
1618
1630
|
constructor({
|
|
1619
1631
|
editor,
|
|
@@ -1772,9 +1784,26 @@ var BubbleMenuView = class {
|
|
|
1772
1784
|
}
|
|
1773
1785
|
updatePosition() {
|
|
1774
1786
|
const { selection } = this.editor.state;
|
|
1775
|
-
|
|
1787
|
+
let virtualElement = {
|
|
1776
1788
|
getBoundingClientRect: () => (0, import_core3.posToDOMRect)(this.view, selection.from, selection.to)
|
|
1777
1789
|
};
|
|
1790
|
+
if (selection instanceof import_tables.CellSelection) {
|
|
1791
|
+
const { $anchorCell, $headCell } = selection;
|
|
1792
|
+
const from = $anchorCell ? $anchorCell.pos : $headCell.pos;
|
|
1793
|
+
const to = $headCell ? $headCell.pos : $anchorCell.pos;
|
|
1794
|
+
const fromDOM = this.view.nodeDOM(from);
|
|
1795
|
+
const toDOM = this.view.nodeDOM(to);
|
|
1796
|
+
if (!fromDOM || !toDOM) {
|
|
1797
|
+
return;
|
|
1798
|
+
}
|
|
1799
|
+
const clientRect = fromDOM === toDOM ? fromDOM.getBoundingClientRect() : combineDOMRects(
|
|
1800
|
+
fromDOM.getBoundingClientRect(),
|
|
1801
|
+
toDOM.getBoundingClientRect()
|
|
1802
|
+
);
|
|
1803
|
+
virtualElement = {
|
|
1804
|
+
getBoundingClientRect: () => clientRect
|
|
1805
|
+
};
|
|
1806
|
+
}
|
|
1778
1807
|
computePosition2(virtualElement, this.element, {
|
|
1779
1808
|
placement: this.floatingUIOptions.placement,
|
|
1780
1809
|
strategy: this.floatingUIOptions.strategy,
|