@tiptap/vue-2 3.0.8 → 3.1.0
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 +19 -2
- package/dist/menus/index.cjs.map +1 -1
- package/dist/menus/index.d.cts +9 -0
- package/dist/menus/index.d.ts +9 -0
- package/dist/menus/index.js +20 -3
- package/dist/menus/index.js.map +1 -1
- package/package.json +7 -7
package/dist/menus/index.d.cts
CHANGED
|
@@ -48,6 +48,15 @@ interface BubbleMenuPluginProps {
|
|
|
48
48
|
from: number;
|
|
49
49
|
to: number;
|
|
50
50
|
}) => boolean) | null;
|
|
51
|
+
/**
|
|
52
|
+
* The DOM element to append your menu to. Default is the editor's parent element.
|
|
53
|
+
*
|
|
54
|
+
* Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.
|
|
55
|
+
*
|
|
56
|
+
* @type {HTMLElement}
|
|
57
|
+
* @default null
|
|
58
|
+
*/
|
|
59
|
+
appendTo?: HTMLElement;
|
|
51
60
|
/**
|
|
52
61
|
* The options for the bubble menu. Those are passed to Floating UI and include options for the placement, offset, flip, shift, arrow, size, autoPlacement,
|
|
53
62
|
* hide, and inline middlewares.
|
package/dist/menus/index.d.ts
CHANGED
|
@@ -48,6 +48,15 @@ interface BubbleMenuPluginProps {
|
|
|
48
48
|
from: number;
|
|
49
49
|
to: number;
|
|
50
50
|
}) => boolean) | null;
|
|
51
|
+
/**
|
|
52
|
+
* The DOM element to append your menu to. Default is the editor's parent element.
|
|
53
|
+
*
|
|
54
|
+
* Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.
|
|
55
|
+
*
|
|
56
|
+
* @type {HTMLElement}
|
|
57
|
+
* @default null
|
|
58
|
+
*/
|
|
59
|
+
appendTo?: HTMLElement;
|
|
51
60
|
/**
|
|
52
61
|
* The options for the bubble menu. Those are passed to Floating UI and include options for the placement, offset, flip, shift, arrow, size, autoPlacement,
|
|
53
62
|
* hide, and inline middlewares.
|
package/dist/menus/index.js
CHANGED
|
@@ -1586,7 +1586,7 @@ var computePosition2 = (reference, floating, options) => {
|
|
|
1586
1586
|
|
|
1587
1587
|
// ../extension-bubble-menu/dist/index.js
|
|
1588
1588
|
import { isTextSelection, posToDOMRect } from "@tiptap/core";
|
|
1589
|
-
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
1589
|
+
import { NodeSelection, Plugin, PluginKey } from "@tiptap/pm/state";
|
|
1590
1590
|
import { CellSelection } from "@tiptap/pm/tables";
|
|
1591
1591
|
function combineDOMRects(rect1, rect2) {
|
|
1592
1592
|
const top = Math.min(rect1.top, rect2.top);
|
|
@@ -1607,6 +1607,7 @@ var BubbleMenuView = class {
|
|
|
1607
1607
|
updateDelay = 250,
|
|
1608
1608
|
resizeDelay = 60,
|
|
1609
1609
|
shouldShow,
|
|
1610
|
+
appendTo,
|
|
1610
1611
|
options
|
|
1611
1612
|
}) {
|
|
1612
1613
|
this.preventHide = false;
|
|
@@ -1701,6 +1702,7 @@ var BubbleMenuView = class {
|
|
|
1701
1702
|
this.view = view;
|
|
1702
1703
|
this.updateDelay = updateDelay;
|
|
1703
1704
|
this.resizeDelay = resizeDelay;
|
|
1705
|
+
this.appendTo = appendTo;
|
|
1704
1706
|
this.floatingUIOptions = {
|
|
1705
1707
|
...this.floatingUIOptions,
|
|
1706
1708
|
...options
|
|
@@ -1764,6 +1766,19 @@ var BubbleMenuView = class {
|
|
|
1764
1766
|
getBoundingClientRect: () => domRect,
|
|
1765
1767
|
getClientRects: () => [domRect]
|
|
1766
1768
|
};
|
|
1769
|
+
if (selection instanceof NodeSelection) {
|
|
1770
|
+
let node = this.view.nodeDOM(selection.from);
|
|
1771
|
+
const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector("[data-node-view-wrapper]");
|
|
1772
|
+
if (nodeViewWrapper) {
|
|
1773
|
+
node = nodeViewWrapper;
|
|
1774
|
+
}
|
|
1775
|
+
if (node) {
|
|
1776
|
+
virtualElement = {
|
|
1777
|
+
getBoundingClientRect: () => node.getBoundingClientRect(),
|
|
1778
|
+
getClientRects: () => [node.getBoundingClientRect()]
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1767
1782
|
if (selection instanceof CellSelection) {
|
|
1768
1783
|
const { $anchorCell, $headCell } = selection;
|
|
1769
1784
|
const from = $anchorCell ? $anchorCell.pos : $headCell.pos;
|
|
@@ -1826,13 +1841,13 @@ var BubbleMenuView = class {
|
|
|
1826
1841
|
return shouldShow;
|
|
1827
1842
|
}
|
|
1828
1843
|
show() {
|
|
1829
|
-
var _a;
|
|
1844
|
+
var _a, _b;
|
|
1830
1845
|
if (this.isVisible) {
|
|
1831
1846
|
return;
|
|
1832
1847
|
}
|
|
1833
1848
|
this.element.style.visibility = "visible";
|
|
1834
1849
|
this.element.style.opacity = "1";
|
|
1835
|
-
(_a = this.view.dom.parentElement) == null ? void 0 :
|
|
1850
|
+
(_b = (_a = this.appendTo) != null ? _a : this.view.dom.parentElement) == null ? void 0 : _b.appendChild(this.element);
|
|
1836
1851
|
if (this.floatingUIOptions.onShow) {
|
|
1837
1852
|
this.floatingUIOptions.onShow();
|
|
1838
1853
|
}
|
|
@@ -1875,6 +1890,7 @@ var BubbleMenu = Extension.create({
|
|
|
1875
1890
|
element: null,
|
|
1876
1891
|
pluginKey: "bubbleMenu",
|
|
1877
1892
|
updateDelay: void 0,
|
|
1893
|
+
appendTo: void 0,
|
|
1878
1894
|
shouldShow: null
|
|
1879
1895
|
};
|
|
1880
1896
|
},
|
|
@@ -1889,6 +1905,7 @@ var BubbleMenu = Extension.create({
|
|
|
1889
1905
|
element: this.options.element,
|
|
1890
1906
|
updateDelay: this.options.updateDelay,
|
|
1891
1907
|
options: this.options.options,
|
|
1908
|
+
appendTo: this.options.appendTo,
|
|
1892
1909
|
shouldShow: this.options.shouldShow
|
|
1893
1910
|
})
|
|
1894
1911
|
];
|