@tiptap/vue-2 3.20.2 → 3.20.3

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.
@@ -1,218 +0,0 @@
1
- import { VirtualElement, offset, flip, shift, arrow, size, autoPlacement, hide, inline } from '@floating-ui/dom';
2
- import { Editor } from '@tiptap/core';
3
- import { PluginKey, EditorState } from '@tiptap/pm/state';
4
- import { EditorView } from '@tiptap/pm/view';
5
- import { VNode, Component } from 'vue';
6
-
7
- interface BubbleMenuPluginProps {
8
- /**
9
- * The plugin key.
10
- * @type {PluginKey | string}
11
- * @default 'bubbleMenu'
12
- */
13
- pluginKey: PluginKey | string;
14
- /**
15
- * The editor instance.
16
- */
17
- editor: Editor;
18
- /**
19
- * The DOM element that contains your menu.
20
- * @type {HTMLElement}
21
- * @default null
22
- */
23
- element: HTMLElement;
24
- /**
25
- * The delay in milliseconds before the menu should be updated.
26
- * This can be useful to prevent performance issues.
27
- * @type {number}
28
- * @default 250
29
- */
30
- updateDelay?: number;
31
- /**
32
- * The delay in milliseconds before the menu position should be updated on window resize.
33
- * This can be useful to prevent performance issues.
34
- * @type {number}
35
- * @default 60
36
- */
37
- resizeDelay?: number;
38
- /**
39
- * A function that determines whether the menu should be shown or not.
40
- * If this function returns `false`, the menu will be hidden, otherwise it will be shown.
41
- */
42
- shouldShow?: ((props: {
43
- editor: Editor;
44
- element: HTMLElement;
45
- view: EditorView;
46
- state: EditorState;
47
- oldState?: EditorState;
48
- from: number;
49
- to: number;
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 | (() => HTMLElement);
60
- /**
61
- * A function that returns the virtual element for the menu.
62
- * This is useful when the menu needs to be positioned relative to a specific DOM element.
63
- * @type {() => VirtualElement | null}
64
- * @default Position based on the selection.
65
- */
66
- getReferencedVirtualElement?: () => VirtualElement | null;
67
- /**
68
- * The options for the bubble menu. Those are passed to Floating UI and include options for the placement, offset, flip, shift, arrow, size, autoPlacement,
69
- * hide, and inline middlewares.
70
- * @default {}
71
- * @see https://floating-ui.com/docs/computePosition#options
72
- */
73
- options?: {
74
- strategy?: 'absolute' | 'fixed';
75
- placement?: 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end';
76
- offset?: Parameters<typeof offset>[0] | boolean;
77
- flip?: Parameters<typeof flip>[0] | boolean;
78
- shift?: Parameters<typeof shift>[0] | boolean;
79
- arrow?: Parameters<typeof arrow>[0] | false;
80
- size?: Parameters<typeof size>[0] | boolean;
81
- autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean;
82
- hide?: Parameters<typeof hide>[0] | boolean;
83
- inline?: Parameters<typeof inline>[0] | boolean;
84
- onShow?: () => void;
85
- onHide?: () => void;
86
- onUpdate?: () => void;
87
- onDestroy?: () => void;
88
- /**
89
- * The scrollable element that should be listened to when updating the position of the bubble menu.
90
- * If not provided, the window will be used.
91
- * @type {HTMLElement | Window}
92
- */
93
- scrollTarget?: HTMLElement | Window;
94
- };
95
- }
96
-
97
- interface BubbleMenuInterface {
98
- $el: HTMLElement;
99
- $nextTick: (callback: () => void) => void;
100
- $slots: {
101
- default?: VNode[];
102
- };
103
- pluginKey: BubbleMenuPluginProps['pluginKey'];
104
- editor: BubbleMenuPluginProps['editor'];
105
- updateDelay: BubbleMenuPluginProps['updateDelay'];
106
- resizeDelay: BubbleMenuPluginProps['resizeDelay'];
107
- appendTo: BubbleMenuPluginProps['appendTo'];
108
- shouldShow: BubbleMenuPluginProps['shouldShow'];
109
- getReferencedVirtualElement: BubbleMenuPluginProps['getReferencedVirtualElement'];
110
- options: BubbleMenuPluginProps['options'];
111
- }
112
- declare const BubbleMenu: Component;
113
-
114
- interface FloatingMenuPluginProps {
115
- /**
116
- * The plugin key for the floating menu.
117
- * @default 'floatingMenu'
118
- */
119
- pluginKey: PluginKey | string;
120
- /**
121
- * The editor instance.
122
- * @default null
123
- */
124
- editor: Editor;
125
- /**
126
- * The DOM element that contains your menu.
127
- * @default null
128
- */
129
- element: HTMLElement;
130
- /**
131
- * The delay in milliseconds before the menu should be updated.
132
- * This can be useful to prevent performance issues.
133
- * @type {number}
134
- * @default 250
135
- */
136
- updateDelay?: number;
137
- /**
138
- * The delay in milliseconds before the menu position should be updated on window resize.
139
- * This can be useful to prevent performance issues.
140
- * @type {number}
141
- * @default 60
142
- */
143
- resizeDelay?: number;
144
- /**
145
- * The DOM element to append your menu to. Default is the editor's parent element.
146
- *
147
- * Sometimes the menu needs to be appended to a different DOM context due to accessibility, clipping, or z-index issues.
148
- *
149
- * @type {HTMLElement}
150
- * @default null
151
- */
152
- appendTo?: HTMLElement | (() => HTMLElement);
153
- /**
154
- * A function that determines whether the menu should be shown or not.
155
- * If this function returns `false`, the menu will be hidden, otherwise it will be shown.
156
- */
157
- shouldShow?: ((props: {
158
- editor: Editor;
159
- view: EditorView;
160
- state: EditorState;
161
- oldState?: EditorState;
162
- from: number;
163
- to: number;
164
- }) => boolean) | null;
165
- /**
166
- * The options for the floating menu. Those are passed to Floating UI and include options for the placement, offset, flip, shift, arrow, size, autoPlacement,
167
- * hide, and inline middlewares.
168
- * @default {}
169
- * @see https://floating-ui.com/docs/computePosition#options
170
- */
171
- options?: {
172
- strategy?: 'absolute' | 'fixed';
173
- placement?: 'top' | 'right' | 'bottom' | 'left' | 'top-start' | 'top-end' | 'right-start' | 'right-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end';
174
- offset?: Parameters<typeof offset>[0] | boolean;
175
- flip?: Parameters<typeof flip>[0] | boolean;
176
- shift?: Parameters<typeof shift>[0] | boolean;
177
- arrow?: Parameters<typeof arrow>[0] | false;
178
- size?: Parameters<typeof size>[0] | boolean;
179
- autoPlacement?: Parameters<typeof autoPlacement>[0] | boolean;
180
- hide?: Parameters<typeof hide>[0] | boolean;
181
- inline?: Parameters<typeof inline>[0] | boolean;
182
- onShow?: () => void;
183
- onHide?: () => void;
184
- onUpdate?: () => void;
185
- onDestroy?: () => void;
186
- /**
187
- * The scrollable element that should be listened to when updating the position of the floating menu.
188
- * If not provided, the window will be used.
189
- * @type {HTMLElement | Window}
190
- */
191
- scrollTarget?: HTMLElement | Window;
192
- };
193
- }
194
-
195
- declare module '@tiptap/core' {
196
- interface Commands<ReturnType> {
197
- floatingMenu: {
198
- /**
199
- * Update the position of the floating menu.
200
- * @example editor.commands.updateFloatingMenuPosition()
201
- */
202
- updateFloatingMenuPosition: () => ReturnType;
203
- };
204
- }
205
- }
206
-
207
- interface FloatingMenuInterface extends Vue {
208
- pluginKey: FloatingMenuPluginProps['pluginKey'];
209
- editor: FloatingMenuPluginProps['editor'];
210
- updateDelay: FloatingMenuPluginProps['updateDelay'];
211
- resizeDelay: FloatingMenuPluginProps['resizeDelay'];
212
- options: FloatingMenuPluginProps['options'];
213
- appendTo: FloatingMenuPluginProps['appendTo'];
214
- shouldShow: FloatingMenuPluginProps['shouldShow'];
215
- }
216
- declare const FloatingMenu: Component;
217
-
218
- export { BubbleMenu, type BubbleMenuInterface, FloatingMenu, type FloatingMenuInterface };