@tiptap/vue-2 3.20.2 → 3.20.4
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 +55 -11
- 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 +54 -10
- package/dist/menus/index.js.map +1 -1
- package/package.json +7 -7
- package/src/menus/BubbleMenu.ts +33 -4
- package/src/menus/FloatingMenu.ts +32 -4
package/dist/menus/index.d.cts
CHANGED
|
@@ -96,11 +96,15 @@ interface BubbleMenuPluginProps {
|
|
|
96
96
|
|
|
97
97
|
interface BubbleMenuInterface {
|
|
98
98
|
$el: HTMLElement;
|
|
99
|
+
$attrs: Record<string, any>;
|
|
100
|
+
$listeners: Record<string, (...args: any[]) => unknown>;
|
|
99
101
|
$nextTick: (callback: () => void) => void;
|
|
100
102
|
$slots: {
|
|
101
103
|
default?: VNode[];
|
|
102
104
|
};
|
|
105
|
+
$vnode?: VNode;
|
|
103
106
|
pluginKey: BubbleMenuPluginProps['pluginKey'];
|
|
107
|
+
generatedPluginKey?: BubbleMenuPluginProps['pluginKey'];
|
|
104
108
|
editor: BubbleMenuPluginProps['editor'];
|
|
105
109
|
updateDelay: BubbleMenuPluginProps['updateDelay'];
|
|
106
110
|
resizeDelay: BubbleMenuPluginProps['resizeDelay'];
|
|
@@ -108,6 +112,7 @@ interface BubbleMenuInterface {
|
|
|
108
112
|
shouldShow: BubbleMenuPluginProps['shouldShow'];
|
|
109
113
|
getReferencedVirtualElement: BubbleMenuPluginProps['getReferencedVirtualElement'];
|
|
110
114
|
options: BubbleMenuPluginProps['options'];
|
|
115
|
+
getPluginKey: () => BubbleMenuPluginProps['pluginKey'];
|
|
111
116
|
}
|
|
112
117
|
declare const BubbleMenu: Component;
|
|
113
118
|
|
|
@@ -205,13 +210,17 @@ declare module '@tiptap/core' {
|
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
interface FloatingMenuInterface extends Vue {
|
|
213
|
+
$attrs: Record<string, any>;
|
|
214
|
+
$listeners: Record<string, (...args: any[]) => unknown>;
|
|
208
215
|
pluginKey: FloatingMenuPluginProps['pluginKey'];
|
|
216
|
+
generatedPluginKey?: FloatingMenuPluginProps['pluginKey'];
|
|
209
217
|
editor: FloatingMenuPluginProps['editor'];
|
|
210
218
|
updateDelay: FloatingMenuPluginProps['updateDelay'];
|
|
211
219
|
resizeDelay: FloatingMenuPluginProps['resizeDelay'];
|
|
212
220
|
options: FloatingMenuPluginProps['options'];
|
|
213
221
|
appendTo: FloatingMenuPluginProps['appendTo'];
|
|
214
222
|
shouldShow: FloatingMenuPluginProps['shouldShow'];
|
|
223
|
+
getPluginKey: () => FloatingMenuPluginProps['pluginKey'];
|
|
215
224
|
}
|
|
216
225
|
declare const FloatingMenu: Component;
|
|
217
226
|
|
package/dist/menus/index.d.ts
CHANGED
|
@@ -96,11 +96,15 @@ interface BubbleMenuPluginProps {
|
|
|
96
96
|
|
|
97
97
|
interface BubbleMenuInterface {
|
|
98
98
|
$el: HTMLElement;
|
|
99
|
+
$attrs: Record<string, any>;
|
|
100
|
+
$listeners: Record<string, (...args: any[]) => unknown>;
|
|
99
101
|
$nextTick: (callback: () => void) => void;
|
|
100
102
|
$slots: {
|
|
101
103
|
default?: VNode[];
|
|
102
104
|
};
|
|
105
|
+
$vnode?: VNode;
|
|
103
106
|
pluginKey: BubbleMenuPluginProps['pluginKey'];
|
|
107
|
+
generatedPluginKey?: BubbleMenuPluginProps['pluginKey'];
|
|
104
108
|
editor: BubbleMenuPluginProps['editor'];
|
|
105
109
|
updateDelay: BubbleMenuPluginProps['updateDelay'];
|
|
106
110
|
resizeDelay: BubbleMenuPluginProps['resizeDelay'];
|
|
@@ -108,6 +112,7 @@ interface BubbleMenuInterface {
|
|
|
108
112
|
shouldShow: BubbleMenuPluginProps['shouldShow'];
|
|
109
113
|
getReferencedVirtualElement: BubbleMenuPluginProps['getReferencedVirtualElement'];
|
|
110
114
|
options: BubbleMenuPluginProps['options'];
|
|
115
|
+
getPluginKey: () => BubbleMenuPluginProps['pluginKey'];
|
|
111
116
|
}
|
|
112
117
|
declare const BubbleMenu: Component;
|
|
113
118
|
|
|
@@ -205,13 +210,17 @@ declare module '@tiptap/core' {
|
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
interface FloatingMenuInterface extends Vue {
|
|
213
|
+
$attrs: Record<string, any>;
|
|
214
|
+
$listeners: Record<string, (...args: any[]) => unknown>;
|
|
208
215
|
pluginKey: FloatingMenuPluginProps['pluginKey'];
|
|
216
|
+
generatedPluginKey?: FloatingMenuPluginProps['pluginKey'];
|
|
209
217
|
editor: FloatingMenuPluginProps['editor'];
|
|
210
218
|
updateDelay: FloatingMenuPluginProps['updateDelay'];
|
|
211
219
|
resizeDelay: FloatingMenuPluginProps['resizeDelay'];
|
|
212
220
|
options: FloatingMenuPluginProps['options'];
|
|
213
221
|
appendTo: FloatingMenuPluginProps['appendTo'];
|
|
214
222
|
shouldShow: FloatingMenuPluginProps['shouldShow'];
|
|
223
|
+
getPluginKey: () => FloatingMenuPluginProps['pluginKey'];
|
|
215
224
|
}
|
|
216
225
|
declare const FloatingMenu: Component;
|
|
217
226
|
|
package/dist/menus/index.js
CHANGED
|
@@ -1971,12 +1971,14 @@ var BubbleMenuPlugin = (options) => {
|
|
|
1971
1971
|
};
|
|
1972
1972
|
|
|
1973
1973
|
// src/menus/BubbleMenu.ts
|
|
1974
|
+
import { PluginKey as PluginKey2 } from "@tiptap/pm/state";
|
|
1974
1975
|
var BubbleMenu = {
|
|
1975
1976
|
name: "BubbleMenu",
|
|
1977
|
+
inheritAttrs: false,
|
|
1976
1978
|
props: {
|
|
1977
1979
|
pluginKey: {
|
|
1978
1980
|
type: [String, Object],
|
|
1979
|
-
default:
|
|
1981
|
+
default: void 0
|
|
1980
1982
|
},
|
|
1981
1983
|
editor: {
|
|
1982
1984
|
type: Object,
|
|
@@ -2018,7 +2020,7 @@ var BubbleMenu = {
|
|
|
2018
2020
|
options: this.options,
|
|
2019
2021
|
editor,
|
|
2020
2022
|
element: el,
|
|
2021
|
-
pluginKey: this.
|
|
2023
|
+
pluginKey: this.getPluginKey(),
|
|
2022
2024
|
appendTo: this.appendTo,
|
|
2023
2025
|
shouldShow: this.shouldShow,
|
|
2024
2026
|
getReferencedVirtualElement: this.getReferencedVirtualElement
|
|
@@ -2027,16 +2029,36 @@ var BubbleMenu = {
|
|
|
2027
2029
|
});
|
|
2028
2030
|
},
|
|
2029
2031
|
render(createElement) {
|
|
2030
|
-
|
|
2032
|
+
var _a, _b;
|
|
2033
|
+
const vnodeData = (_b = (_a = this.$vnode) == null ? void 0 : _a.data) != null ? _b : {};
|
|
2034
|
+
return createElement(
|
|
2035
|
+
"div",
|
|
2036
|
+
{
|
|
2037
|
+
attrs: this.$attrs,
|
|
2038
|
+
on: this.$listeners,
|
|
2039
|
+
class: [vnodeData.staticClass, vnodeData.class],
|
|
2040
|
+
style: [vnodeData.staticStyle, vnodeData.style]
|
|
2041
|
+
},
|
|
2042
|
+
this.$slots.default
|
|
2043
|
+
);
|
|
2031
2044
|
},
|
|
2032
2045
|
beforeDestroy() {
|
|
2033
|
-
this.editor.unregisterPlugin(this.
|
|
2046
|
+
this.editor.unregisterPlugin(this.getPluginKey());
|
|
2047
|
+
},
|
|
2048
|
+
methods: {
|
|
2049
|
+
getPluginKey() {
|
|
2050
|
+
var _a;
|
|
2051
|
+
if (!this.generatedPluginKey) {
|
|
2052
|
+
this.generatedPluginKey = (_a = this.pluginKey) != null ? _a : new PluginKey2("bubbleMenu");
|
|
2053
|
+
}
|
|
2054
|
+
return this.generatedPluginKey;
|
|
2055
|
+
}
|
|
2034
2056
|
}
|
|
2035
2057
|
};
|
|
2036
2058
|
|
|
2037
2059
|
// ../extension-floating-menu/src/floating-menu-plugin.ts
|
|
2038
2060
|
import { getText, getTextSerializersFromSchema, posToDOMRect as posToDOMRect2 } from "@tiptap/core";
|
|
2039
|
-
import { Plugin as Plugin2, PluginKey as
|
|
2061
|
+
import { Plugin as Plugin2, PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
2040
2062
|
var FloatingMenuView = class {
|
|
2041
2063
|
constructor({
|
|
2042
2064
|
editor,
|
|
@@ -2324,18 +2346,20 @@ var FloatingMenuView = class {
|
|
|
2324
2346
|
};
|
|
2325
2347
|
var FloatingMenuPlugin = (options) => {
|
|
2326
2348
|
return new Plugin2({
|
|
2327
|
-
key: typeof options.pluginKey === "string" ? new
|
|
2349
|
+
key: typeof options.pluginKey === "string" ? new PluginKey3(options.pluginKey) : options.pluginKey,
|
|
2328
2350
|
view: (view) => new FloatingMenuView({ view, ...options })
|
|
2329
2351
|
});
|
|
2330
2352
|
};
|
|
2331
2353
|
|
|
2332
2354
|
// src/menus/FloatingMenu.ts
|
|
2355
|
+
import { PluginKey as PluginKey4 } from "@tiptap/pm/state";
|
|
2333
2356
|
var FloatingMenu = {
|
|
2334
2357
|
name: "FloatingMenu",
|
|
2358
|
+
inheritAttrs: false,
|
|
2335
2359
|
props: {
|
|
2336
2360
|
pluginKey: {
|
|
2337
2361
|
type: [String, Object],
|
|
2338
|
-
default:
|
|
2362
|
+
default: void 0
|
|
2339
2363
|
},
|
|
2340
2364
|
editor: {
|
|
2341
2365
|
type: Object,
|
|
@@ -2377,7 +2401,7 @@ var FloatingMenu = {
|
|
|
2377
2401
|
this.$nextTick(() => {
|
|
2378
2402
|
editor.registerPlugin(
|
|
2379
2403
|
FloatingMenuPlugin({
|
|
2380
|
-
pluginKey: this.
|
|
2404
|
+
pluginKey: this.getPluginKey(),
|
|
2381
2405
|
editor,
|
|
2382
2406
|
element: this.$el,
|
|
2383
2407
|
updateDelay: this.updateDelay,
|
|
@@ -2392,10 +2416,30 @@ var FloatingMenu = {
|
|
|
2392
2416
|
}
|
|
2393
2417
|
},
|
|
2394
2418
|
render(createElement) {
|
|
2395
|
-
|
|
2419
|
+
var _a, _b;
|
|
2420
|
+
const vnodeData = (_b = (_a = this.$vnode) == null ? void 0 : _a.data) != null ? _b : {};
|
|
2421
|
+
return createElement(
|
|
2422
|
+
"div",
|
|
2423
|
+
{
|
|
2424
|
+
attrs: this.$attrs,
|
|
2425
|
+
on: this.$listeners,
|
|
2426
|
+
class: [vnodeData.staticClass, vnodeData.class],
|
|
2427
|
+
style: [vnodeData.staticStyle, vnodeData.style]
|
|
2428
|
+
},
|
|
2429
|
+
this.$slots.default
|
|
2430
|
+
);
|
|
2396
2431
|
},
|
|
2397
2432
|
beforeDestroy() {
|
|
2398
|
-
this.editor.unregisterPlugin(this.
|
|
2433
|
+
this.editor.unregisterPlugin(this.getPluginKey());
|
|
2434
|
+
},
|
|
2435
|
+
methods: {
|
|
2436
|
+
getPluginKey() {
|
|
2437
|
+
var _a;
|
|
2438
|
+
if (!this.generatedPluginKey) {
|
|
2439
|
+
this.generatedPluginKey = (_a = this.pluginKey) != null ? _a : new PluginKey4("floatingMenu");
|
|
2440
|
+
}
|
|
2441
|
+
return this.generatedPluginKey;
|
|
2442
|
+
}
|
|
2399
2443
|
}
|
|
2400
2444
|
};
|
|
2401
2445
|
export {
|