@tiptap/vue-2 3.0.0-beta.10 → 3.0.0-beta.11
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 +47 -1
- package/dist/menus/index.cjs.map +1 -1
- package/dist/menus/index.d.cts +8 -0
- package/dist/menus/index.d.ts +8 -0
- package/dist/menus/index.js +47 -1
- package/dist/menus/index.js.map +1 -1
- package/package.json +7 -7
package/dist/menus/index.cjs
CHANGED
|
@@ -1625,6 +1625,7 @@ var BubbleMenuView = class {
|
|
|
1625
1625
|
options
|
|
1626
1626
|
}) {
|
|
1627
1627
|
this.preventHide = false;
|
|
1628
|
+
this.isVisible = false;
|
|
1628
1629
|
this.floatingUIOptions = {
|
|
1629
1630
|
strategy: "absolute",
|
|
1630
1631
|
placement: "top",
|
|
@@ -1635,7 +1636,11 @@ var BubbleMenuView = class {
|
|
|
1635
1636
|
size: false,
|
|
1636
1637
|
autoPlacement: false,
|
|
1637
1638
|
hide: false,
|
|
1638
|
-
inline: false
|
|
1639
|
+
inline: false,
|
|
1640
|
+
onShow: void 0,
|
|
1641
|
+
onHide: void 0,
|
|
1642
|
+
onUpdate: void 0,
|
|
1643
|
+
onDestroy: void 0
|
|
1639
1644
|
};
|
|
1640
1645
|
this.shouldShow = ({ view: view2, state, from, to }) => {
|
|
1641
1646
|
const { doc, selection } = state;
|
|
@@ -1779,6 +1784,9 @@ var BubbleMenuView = class {
|
|
|
1779
1784
|
this.element.style.position = strategy;
|
|
1780
1785
|
this.element.style.left = `${x}px`;
|
|
1781
1786
|
this.element.style.top = `${y}px`;
|
|
1787
|
+
if (this.isVisible && this.floatingUIOptions.onUpdate) {
|
|
1788
|
+
this.floatingUIOptions.onUpdate();
|
|
1789
|
+
}
|
|
1782
1790
|
});
|
|
1783
1791
|
}
|
|
1784
1792
|
update(view, oldState) {
|
|
@@ -1812,14 +1820,28 @@ var BubbleMenuView = class {
|
|
|
1812
1820
|
}
|
|
1813
1821
|
show() {
|
|
1814
1822
|
var _a;
|
|
1823
|
+
if (this.isVisible) {
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1815
1826
|
this.element.style.visibility = "visible";
|
|
1816
1827
|
this.element.style.opacity = "1";
|
|
1817
1828
|
(_a = this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
|
|
1829
|
+
if (this.floatingUIOptions.onShow) {
|
|
1830
|
+
this.floatingUIOptions.onShow();
|
|
1831
|
+
}
|
|
1832
|
+
this.isVisible = true;
|
|
1818
1833
|
}
|
|
1819
1834
|
hide() {
|
|
1835
|
+
if (!this.isVisible) {
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1820
1838
|
this.element.style.visibility = "hidden";
|
|
1821
1839
|
this.element.style.opacity = "0";
|
|
1822
1840
|
this.element.remove();
|
|
1841
|
+
if (this.floatingUIOptions.onHide) {
|
|
1842
|
+
this.floatingUIOptions.onHide();
|
|
1843
|
+
}
|
|
1844
|
+
this.isVisible = false;
|
|
1823
1845
|
}
|
|
1824
1846
|
destroy() {
|
|
1825
1847
|
this.hide();
|
|
@@ -1827,6 +1849,9 @@ var BubbleMenuView = class {
|
|
|
1827
1849
|
this.view.dom.removeEventListener("dragstart", this.dragstartHandler);
|
|
1828
1850
|
this.editor.off("focus", this.focusHandler);
|
|
1829
1851
|
this.editor.off("blur", this.blurHandler);
|
|
1852
|
+
if (this.floatingUIOptions.onDestroy) {
|
|
1853
|
+
this.floatingUIOptions.onDestroy();
|
|
1854
|
+
}
|
|
1830
1855
|
}
|
|
1831
1856
|
};
|
|
1832
1857
|
var BubbleMenuPlugin = (options) => {
|
|
@@ -1930,6 +1955,7 @@ var import_state2 = require("@tiptap/pm/state");
|
|
|
1930
1955
|
var FloatingMenuView = class {
|
|
1931
1956
|
constructor({ editor, element, view, options, shouldShow }) {
|
|
1932
1957
|
this.preventHide = false;
|
|
1958
|
+
this.isVisible = false;
|
|
1933
1959
|
this.shouldShow = ({ view: view2, state }) => {
|
|
1934
1960
|
const { selection } = state;
|
|
1935
1961
|
const { $anchor, empty } = selection;
|
|
@@ -2076,6 +2102,9 @@ var FloatingMenuView = class {
|
|
|
2076
2102
|
this.element.style.position = strategy;
|
|
2077
2103
|
this.element.style.left = `${x}px`;
|
|
2078
2104
|
this.element.style.top = `${y}px`;
|
|
2105
|
+
if (this.isVisible && this.floatingUIOptions.onUpdate) {
|
|
2106
|
+
this.floatingUIOptions.onUpdate();
|
|
2107
|
+
}
|
|
2079
2108
|
});
|
|
2080
2109
|
}
|
|
2081
2110
|
update(view, oldState) {
|
|
@@ -2085,20 +2114,37 @@ var FloatingMenuView = class {
|
|
|
2085
2114
|
}
|
|
2086
2115
|
show() {
|
|
2087
2116
|
var _a;
|
|
2117
|
+
if (this.isVisible) {
|
|
2118
|
+
return;
|
|
2119
|
+
}
|
|
2088
2120
|
this.element.style.visibility = "visible";
|
|
2089
2121
|
this.element.style.opacity = "1";
|
|
2090
2122
|
(_a = this.view.dom.parentElement) == null ? void 0 : _a.appendChild(this.element);
|
|
2123
|
+
if (this.floatingUIOptions.onShow) {
|
|
2124
|
+
this.floatingUIOptions.onShow();
|
|
2125
|
+
}
|
|
2126
|
+
this.isVisible = true;
|
|
2091
2127
|
}
|
|
2092
2128
|
hide() {
|
|
2129
|
+
if (!this.isVisible) {
|
|
2130
|
+
return;
|
|
2131
|
+
}
|
|
2093
2132
|
this.element.style.visibility = "hidden";
|
|
2094
2133
|
this.element.style.opacity = "0";
|
|
2095
2134
|
this.element.remove();
|
|
2135
|
+
if (this.floatingUIOptions.onHide) {
|
|
2136
|
+
this.floatingUIOptions.onHide();
|
|
2137
|
+
}
|
|
2138
|
+
this.isVisible = false;
|
|
2096
2139
|
}
|
|
2097
2140
|
destroy() {
|
|
2098
2141
|
this.hide();
|
|
2099
2142
|
this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: true });
|
|
2100
2143
|
this.editor.off("focus", this.focusHandler);
|
|
2101
2144
|
this.editor.off("blur", this.blurHandler);
|
|
2145
|
+
if (this.floatingUIOptions.onDestroy) {
|
|
2146
|
+
this.floatingUIOptions.onDestroy();
|
|
2147
|
+
}
|
|
2102
2148
|
}
|
|
2103
2149
|
};
|
|
2104
2150
|
var FloatingMenuPlugin = (options) => {
|