@tiptap/vue-2 3.17.1 → 3.19.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 +65 -0
- package/dist/menus/index.cjs.map +1 -1
- package/dist/menus/index.js +65 -0
- package/dist/menus/index.js.map +1 -1
- package/package.json +7 -7
package/dist/menus/index.cjs
CHANGED
|
@@ -1736,6 +1736,8 @@ var BubbleMenuView = class {
|
|
|
1736
1736
|
const meta = tr.getMeta("bubbleMenu");
|
|
1737
1737
|
if (meta === "updatePosition") {
|
|
1738
1738
|
this.updatePosition();
|
|
1739
|
+
} else if (meta && typeof meta === "object" && meta.type === "updateOptions") {
|
|
1740
|
+
this.updateOptions(meta.options);
|
|
1739
1741
|
}
|
|
1740
1742
|
};
|
|
1741
1743
|
var _a;
|
|
@@ -1934,6 +1936,38 @@ var BubbleMenuView = class {
|
|
|
1934
1936
|
}
|
|
1935
1937
|
this.isVisible = false;
|
|
1936
1938
|
}
|
|
1939
|
+
updateOptions(newProps) {
|
|
1940
|
+
var _a;
|
|
1941
|
+
if (newProps.updateDelay !== void 0) {
|
|
1942
|
+
this.updateDelay = newProps.updateDelay;
|
|
1943
|
+
}
|
|
1944
|
+
if (newProps.resizeDelay !== void 0) {
|
|
1945
|
+
this.resizeDelay = newProps.resizeDelay;
|
|
1946
|
+
}
|
|
1947
|
+
if (newProps.appendTo !== void 0) {
|
|
1948
|
+
this.appendTo = newProps.appendTo;
|
|
1949
|
+
}
|
|
1950
|
+
if (newProps.getReferencedVirtualElement !== void 0) {
|
|
1951
|
+
this.getReferencedVirtualElement = newProps.getReferencedVirtualElement;
|
|
1952
|
+
}
|
|
1953
|
+
if (newProps.shouldShow !== void 0) {
|
|
1954
|
+
if (newProps.shouldShow) {
|
|
1955
|
+
this.shouldShow = newProps.shouldShow;
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
if (newProps.options !== void 0) {
|
|
1959
|
+
const newScrollTarget = (_a = newProps.options.scrollTarget) != null ? _a : window;
|
|
1960
|
+
if (newScrollTarget !== this.scrollTarget) {
|
|
1961
|
+
this.scrollTarget.removeEventListener("scroll", this.resizeHandler);
|
|
1962
|
+
this.scrollTarget = newScrollTarget;
|
|
1963
|
+
this.scrollTarget.addEventListener("scroll", this.resizeHandler);
|
|
1964
|
+
}
|
|
1965
|
+
this.floatingUIOptions = {
|
|
1966
|
+
...this.floatingUIOptions,
|
|
1967
|
+
...newProps.options
|
|
1968
|
+
};
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1937
1971
|
destroy() {
|
|
1938
1972
|
this.hide();
|
|
1939
1973
|
this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: true });
|
|
@@ -2101,6 +2135,8 @@ var FloatingMenuView = class {
|
|
|
2101
2135
|
const meta = tr.getMeta("floatingMenu");
|
|
2102
2136
|
if (meta === "updatePosition") {
|
|
2103
2137
|
this.updatePosition();
|
|
2138
|
+
} else if (meta && typeof meta === "object" && meta.type === "updateOptions") {
|
|
2139
|
+
this.updateOptions(meta.options);
|
|
2104
2140
|
}
|
|
2105
2141
|
};
|
|
2106
2142
|
/**
|
|
@@ -2202,6 +2238,35 @@ var FloatingMenuView = class {
|
|
|
2202
2238
|
});
|
|
2203
2239
|
return shouldShow;
|
|
2204
2240
|
}
|
|
2241
|
+
updateOptions(newProps) {
|
|
2242
|
+
var _a;
|
|
2243
|
+
if (newProps.updateDelay !== void 0) {
|
|
2244
|
+
this.updateDelay = newProps.updateDelay;
|
|
2245
|
+
}
|
|
2246
|
+
if (newProps.resizeDelay !== void 0) {
|
|
2247
|
+
this.resizeDelay = newProps.resizeDelay;
|
|
2248
|
+
}
|
|
2249
|
+
if (newProps.appendTo !== void 0) {
|
|
2250
|
+
this.appendTo = newProps.appendTo;
|
|
2251
|
+
}
|
|
2252
|
+
if (newProps.shouldShow !== void 0) {
|
|
2253
|
+
if (newProps.shouldShow) {
|
|
2254
|
+
this.shouldShow = newProps.shouldShow;
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
if (newProps.options !== void 0) {
|
|
2258
|
+
const newScrollTarget = (_a = newProps.options.scrollTarget) != null ? _a : window;
|
|
2259
|
+
if (newScrollTarget !== this.scrollTarget) {
|
|
2260
|
+
this.scrollTarget.removeEventListener("scroll", this.resizeHandler);
|
|
2261
|
+
this.scrollTarget = newScrollTarget;
|
|
2262
|
+
this.scrollTarget.addEventListener("scroll", this.resizeHandler);
|
|
2263
|
+
}
|
|
2264
|
+
this.floatingUIOptions = {
|
|
2265
|
+
...this.floatingUIOptions,
|
|
2266
|
+
...newProps.options
|
|
2267
|
+
};
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2205
2270
|
updatePosition() {
|
|
2206
2271
|
const { selection } = this.editor.state;
|
|
2207
2272
|
const domRect = (0, import_core3.posToDOMRect)(this.view, selection.from, selection.to);
|