@tiptap/react 3.20.3 → 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.
@@ -0,0 +1,499 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/menus/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ BubbleMenu: () => BubbleMenu,
34
+ FloatingMenu: () => FloatingMenu
35
+ });
36
+ module.exports = __toCommonJS(index_exports);
37
+
38
+ // src/menus/BubbleMenu.tsx
39
+ var import_extension_bubble_menu = require("@tiptap/extension-bubble-menu");
40
+ var import_react2 = require("@tiptap/react");
41
+ var import_react3 = __toESM(require("react"), 1);
42
+ var import_react_dom = require("react-dom");
43
+
44
+ // src/menus/getAutoPluginKey.ts
45
+ var import_state = require("@tiptap/pm/state");
46
+ function getAutoPluginKey(pluginKey, defaultName) {
47
+ return pluginKey != null ? pluginKey : new import_state.PluginKey(defaultName);
48
+ }
49
+
50
+ // src/menus/useMenuElementProps.ts
51
+ var import_react = require("react");
52
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? import_react.useLayoutEffect : import_react.useEffect;
53
+ var PLUGIN_MANAGED_STYLE_PROPERTIES = /* @__PURE__ */ new Set(["left", "opacity", "position", "top", "visibility", "width"]);
54
+ var UNITLESS_STYLE_PROPERTIES = /* @__PURE__ */ new Set([
55
+ "animationIterationCount",
56
+ "aspectRatio",
57
+ "borderImageOutset",
58
+ "borderImageSlice",
59
+ "borderImageWidth",
60
+ "columnCount",
61
+ "columns",
62
+ "fillOpacity",
63
+ "flex",
64
+ "flexGrow",
65
+ "flexShrink",
66
+ "fontWeight",
67
+ "gridArea",
68
+ "gridColumn",
69
+ "gridColumnEnd",
70
+ "gridColumnStart",
71
+ "gridRow",
72
+ "gridRowEnd",
73
+ "gridRowStart",
74
+ "lineClamp",
75
+ "lineHeight",
76
+ "opacity",
77
+ "order",
78
+ "orphans",
79
+ "scale",
80
+ "stopOpacity",
81
+ "strokeDasharray",
82
+ "strokeDashoffset",
83
+ "strokeMiterlimit",
84
+ "strokeOpacity",
85
+ "strokeWidth",
86
+ "tabSize",
87
+ "widows",
88
+ "zIndex",
89
+ "zoom"
90
+ ]);
91
+ var ATTRIBUTE_EXCLUSIONS = /* @__PURE__ */ new Set(["children", "className", "style"]);
92
+ var DIRECT_PROPERTY_KEYS = /* @__PURE__ */ new Set(["tabIndex"]);
93
+ var FORWARDED_ATTRIBUTE_KEYS = /* @__PURE__ */ new Set([
94
+ "accessKey",
95
+ "autoCapitalize",
96
+ "contentEditable",
97
+ "contextMenu",
98
+ "dir",
99
+ "draggable",
100
+ "enterKeyHint",
101
+ "hidden",
102
+ "id",
103
+ "lang",
104
+ "nonce",
105
+ "role",
106
+ "slot",
107
+ "spellCheck",
108
+ "tabIndex",
109
+ "title",
110
+ "translate"
111
+ ]);
112
+ var SPECIAL_EVENT_NAMES = {
113
+ Blur: "focusout",
114
+ DoubleClick: "dblclick",
115
+ Focus: "focusin",
116
+ MouseEnter: "mouseenter",
117
+ MouseLeave: "mouseleave"
118
+ };
119
+ function isEventProp(key, value) {
120
+ return /^on[A-Z]/.test(key) && typeof value === "function";
121
+ }
122
+ function toAttributeName(key) {
123
+ if (key.startsWith("aria-") || key.startsWith("data-")) {
124
+ return key;
125
+ }
126
+ return key;
127
+ }
128
+ function isForwardedAttributeKey(key) {
129
+ return key.startsWith("aria-") || key.startsWith("data-") || FORWARDED_ATTRIBUTE_KEYS.has(key);
130
+ }
131
+ function toStylePropertyName(key) {
132
+ if (key.startsWith("--")) {
133
+ return key;
134
+ }
135
+ return key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
136
+ }
137
+ function toEventConfig(key) {
138
+ var _a;
139
+ const useCapture = key.endsWith("Capture");
140
+ const baseKey = useCapture ? key.slice(0, -7) : key;
141
+ const reactEventName = baseKey.slice(2);
142
+ const eventName = (_a = SPECIAL_EVENT_NAMES[reactEventName]) != null ? _a : reactEventName.toLowerCase();
143
+ return {
144
+ eventName,
145
+ options: useCapture ? { capture: true } : void 0
146
+ };
147
+ }
148
+ function createSyntheticEvent(element, nativeEvent) {
149
+ let defaultPrevented = nativeEvent.defaultPrevented;
150
+ let propagationStopped = false;
151
+ const syntheticEvent = Object.create(nativeEvent);
152
+ Object.defineProperties(syntheticEvent, {
153
+ nativeEvent: { value: nativeEvent },
154
+ currentTarget: { value: element },
155
+ target: { value: nativeEvent.target },
156
+ persist: { value: () => void 0 },
157
+ isDefaultPrevented: { value: () => defaultPrevented },
158
+ isPropagationStopped: { value: () => propagationStopped },
159
+ preventDefault: {
160
+ value: () => {
161
+ defaultPrevented = true;
162
+ nativeEvent.preventDefault();
163
+ }
164
+ },
165
+ stopPropagation: {
166
+ value: () => {
167
+ propagationStopped = true;
168
+ nativeEvent.stopPropagation();
169
+ }
170
+ }
171
+ });
172
+ return syntheticEvent;
173
+ }
174
+ function isDirectPropertyKey(key) {
175
+ return DIRECT_PROPERTY_KEYS.has(key);
176
+ }
177
+ function setDirectProperty(element, key, value) {
178
+ if (key === "tabIndex") {
179
+ element.tabIndex = Number(value);
180
+ return;
181
+ }
182
+ ;
183
+ element[key] = value;
184
+ }
185
+ function clearDirectProperty(element, key) {
186
+ if (key === "tabIndex") {
187
+ element.removeAttribute("tabindex");
188
+ return;
189
+ }
190
+ const propertyValue = element[key];
191
+ if (typeof propertyValue === "boolean") {
192
+ ;
193
+ element[key] = false;
194
+ return;
195
+ }
196
+ if (typeof propertyValue === "number") {
197
+ ;
198
+ element[key] = 0;
199
+ return;
200
+ }
201
+ ;
202
+ element[key] = "";
203
+ }
204
+ function toStyleValue(styleName, value) {
205
+ if (typeof value !== "number" || value === 0 || styleName.startsWith("--") || UNITLESS_STYLE_PROPERTIES.has(styleName)) {
206
+ return String(value);
207
+ }
208
+ return `${value}px`;
209
+ }
210
+ function removeStyleProperty(element, styleName) {
211
+ if (PLUGIN_MANAGED_STYLE_PROPERTIES.has(styleName)) {
212
+ return;
213
+ }
214
+ element.style.removeProperty(toStylePropertyName(styleName));
215
+ }
216
+ function applyStyleProperty(element, styleName, value) {
217
+ if (PLUGIN_MANAGED_STYLE_PROPERTIES.has(styleName)) {
218
+ return;
219
+ }
220
+ element.style.setProperty(toStylePropertyName(styleName), toStyleValue(styleName, value));
221
+ }
222
+ function syncAttributes(element, prevProps, nextProps) {
223
+ const allKeys = /* @__PURE__ */ new Set([...Object.keys(prevProps), ...Object.keys(nextProps)]);
224
+ allKeys.forEach((key) => {
225
+ if (ATTRIBUTE_EXCLUSIONS.has(key) || !isForwardedAttributeKey(key) || isEventProp(key, prevProps[key]) || isEventProp(key, nextProps[key])) {
226
+ return;
227
+ }
228
+ const prevValue = prevProps[key];
229
+ const nextValue = nextProps[key];
230
+ if (prevValue === nextValue) {
231
+ return;
232
+ }
233
+ const attributeName = toAttributeName(key);
234
+ if (nextValue == null || nextValue === false) {
235
+ if (isDirectPropertyKey(key)) {
236
+ clearDirectProperty(element, key);
237
+ }
238
+ element.removeAttribute(attributeName);
239
+ return;
240
+ }
241
+ if (nextValue === true) {
242
+ if (isDirectPropertyKey(key)) {
243
+ setDirectProperty(element, key, true);
244
+ }
245
+ element.setAttribute(attributeName, "");
246
+ return;
247
+ }
248
+ if (isDirectPropertyKey(key)) {
249
+ setDirectProperty(element, key, nextValue);
250
+ return;
251
+ }
252
+ element.setAttribute(attributeName, String(nextValue));
253
+ });
254
+ }
255
+ function syncClassName(element, prevClassName, nextClassName) {
256
+ if (prevClassName === nextClassName) {
257
+ return;
258
+ }
259
+ if (nextClassName) {
260
+ element.className = nextClassName;
261
+ return;
262
+ }
263
+ element.removeAttribute("class");
264
+ }
265
+ function syncStyles(element, prevStyle, nextStyle) {
266
+ const previousStyle = prevStyle != null ? prevStyle : {};
267
+ const currentStyle = nextStyle != null ? nextStyle : {};
268
+ const allStyleNames = /* @__PURE__ */ new Set([...Object.keys(previousStyle), ...Object.keys(currentStyle)]);
269
+ allStyleNames.forEach((styleName) => {
270
+ const prevValue = previousStyle[styleName];
271
+ const nextValue = currentStyle[styleName];
272
+ if (prevValue === nextValue) {
273
+ return;
274
+ }
275
+ if (nextValue == null) {
276
+ removeStyleProperty(element, styleName);
277
+ return;
278
+ }
279
+ applyStyleProperty(element, styleName, nextValue);
280
+ });
281
+ }
282
+ function syncEventListeners(element, prevListeners, nextProps) {
283
+ prevListeners.forEach(({ eventName, listener, options }) => {
284
+ element.removeEventListener(eventName, listener, options);
285
+ });
286
+ const nextListeners = [];
287
+ Object.entries(nextProps).forEach(([key, value]) => {
288
+ if (!isEventProp(key, value)) {
289
+ return;
290
+ }
291
+ const { eventName, options } = toEventConfig(key);
292
+ const listener = (event) => {
293
+ value(createSyntheticEvent(element, event));
294
+ };
295
+ element.addEventListener(eventName, listener, options);
296
+ nextListeners.push({ eventName, listener, options });
297
+ });
298
+ return nextListeners;
299
+ }
300
+ function useMenuElementProps(element, props) {
301
+ const previousPropsRef = (0, import_react.useRef)({});
302
+ const listenersRef = (0, import_react.useRef)([]);
303
+ useIsomorphicLayoutEffect(() => {
304
+ const previousProps = previousPropsRef.current;
305
+ syncClassName(element, previousProps.className, props.className);
306
+ syncStyles(element, previousProps.style, props.style);
307
+ syncAttributes(element, previousProps, props);
308
+ listenersRef.current = syncEventListeners(element, listenersRef.current, props);
309
+ previousPropsRef.current = props;
310
+ return () => {
311
+ listenersRef.current.forEach(({ eventName, listener, options }) => {
312
+ element.removeEventListener(eventName, listener, options);
313
+ });
314
+ listenersRef.current = [];
315
+ };
316
+ }, [element, props]);
317
+ }
318
+
319
+ // src/menus/BubbleMenu.tsx
320
+ var BubbleMenu = import_react3.default.forwardRef(
321
+ ({
322
+ pluginKey,
323
+ editor,
324
+ updateDelay,
325
+ resizeDelay,
326
+ appendTo,
327
+ shouldShow = null,
328
+ getReferencedVirtualElement,
329
+ options,
330
+ children,
331
+ ...restProps
332
+ }, ref) => {
333
+ const menuEl = (0, import_react3.useRef)(document.createElement("div"));
334
+ const resolvedPluginKey = (0, import_react3.useRef)(getAutoPluginKey(pluginKey, "bubbleMenu")).current;
335
+ useMenuElementProps(menuEl.current, restProps);
336
+ if (typeof ref === "function") {
337
+ ref(menuEl.current);
338
+ } else if (ref) {
339
+ ref.current = menuEl.current;
340
+ }
341
+ const { editor: currentEditor } = (0, import_react2.useCurrentEditor)();
342
+ const pluginEditor = editor || currentEditor;
343
+ const bubbleMenuPluginProps = {
344
+ updateDelay,
345
+ resizeDelay,
346
+ appendTo,
347
+ pluginKey: resolvedPluginKey,
348
+ shouldShow,
349
+ getReferencedVirtualElement,
350
+ options
351
+ };
352
+ const bubbleMenuPluginPropsRef = (0, import_react3.useRef)(bubbleMenuPluginProps);
353
+ bubbleMenuPluginPropsRef.current = bubbleMenuPluginProps;
354
+ const [pluginInitialized, setPluginInitialized] = (0, import_react3.useState)(false);
355
+ const skipFirstUpdateRef = (0, import_react3.useRef)(true);
356
+ (0, import_react3.useEffect)(() => {
357
+ if (pluginEditor == null ? void 0 : pluginEditor.isDestroyed) {
358
+ return;
359
+ }
360
+ if (!pluginEditor) {
361
+ console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
362
+ return;
363
+ }
364
+ const bubbleMenuElement = menuEl.current;
365
+ bubbleMenuElement.style.visibility = "hidden";
366
+ bubbleMenuElement.style.position = "absolute";
367
+ const plugin = (0, import_extension_bubble_menu.BubbleMenuPlugin)({
368
+ ...bubbleMenuPluginPropsRef.current,
369
+ editor: pluginEditor,
370
+ element: bubbleMenuElement
371
+ });
372
+ pluginEditor.registerPlugin(plugin);
373
+ const createdPluginKey = bubbleMenuPluginPropsRef.current.pluginKey;
374
+ skipFirstUpdateRef.current = true;
375
+ setPluginInitialized(true);
376
+ return () => {
377
+ setPluginInitialized(false);
378
+ pluginEditor.unregisterPlugin(createdPluginKey);
379
+ window.requestAnimationFrame(() => {
380
+ if (bubbleMenuElement.parentNode) {
381
+ bubbleMenuElement.parentNode.removeChild(bubbleMenuElement);
382
+ }
383
+ });
384
+ };
385
+ }, [pluginEditor]);
386
+ (0, import_react3.useEffect)(() => {
387
+ if (!pluginInitialized || !pluginEditor || pluginEditor.isDestroyed) {
388
+ return;
389
+ }
390
+ if (skipFirstUpdateRef.current) {
391
+ skipFirstUpdateRef.current = false;
392
+ return;
393
+ }
394
+ pluginEditor.view.dispatch(
395
+ pluginEditor.state.tr.setMeta(resolvedPluginKey, {
396
+ type: "updateOptions",
397
+ options: bubbleMenuPluginPropsRef.current
398
+ })
399
+ );
400
+ }, [
401
+ pluginInitialized,
402
+ pluginEditor,
403
+ updateDelay,
404
+ resizeDelay,
405
+ shouldShow,
406
+ options,
407
+ appendTo,
408
+ getReferencedVirtualElement,
409
+ resolvedPluginKey
410
+ ]);
411
+ return (0, import_react_dom.createPortal)(children, menuEl.current);
412
+ }
413
+ );
414
+
415
+ // src/menus/FloatingMenu.tsx
416
+ var import_extension_floating_menu = require("@tiptap/extension-floating-menu");
417
+ var import_react4 = require("@tiptap/react");
418
+ var import_react5 = __toESM(require("react"), 1);
419
+ var import_react_dom2 = require("react-dom");
420
+ var FloatingMenu = import_react5.default.forwardRef(
421
+ ({ pluginKey, editor, updateDelay, resizeDelay, appendTo, shouldShow = null, options, children, ...restProps }, ref) => {
422
+ const menuEl = (0, import_react5.useRef)(document.createElement("div"));
423
+ const resolvedPluginKey = (0, import_react5.useRef)(getAutoPluginKey(pluginKey, "floatingMenu")).current;
424
+ useMenuElementProps(menuEl.current, restProps);
425
+ if (typeof ref === "function") {
426
+ ref(menuEl.current);
427
+ } else if (ref) {
428
+ ref.current = menuEl.current;
429
+ }
430
+ const { editor: currentEditor } = (0, import_react4.useCurrentEditor)();
431
+ const pluginEditor = editor || currentEditor;
432
+ const floatingMenuPluginProps = {
433
+ updateDelay,
434
+ resizeDelay,
435
+ appendTo,
436
+ pluginKey: resolvedPluginKey,
437
+ shouldShow,
438
+ options
439
+ };
440
+ const floatingMenuPluginPropsRef = (0, import_react5.useRef)(floatingMenuPluginProps);
441
+ floatingMenuPluginPropsRef.current = floatingMenuPluginProps;
442
+ const [pluginInitialized, setPluginInitialized] = (0, import_react5.useState)(false);
443
+ const skipFirstUpdateRef = (0, import_react5.useRef)(true);
444
+ (0, import_react5.useEffect)(() => {
445
+ if (pluginEditor == null ? void 0 : pluginEditor.isDestroyed) {
446
+ return;
447
+ }
448
+ if (!pluginEditor) {
449
+ console.warn(
450
+ "FloatingMenu component is not rendered inside of an editor component or does not have editor prop."
451
+ );
452
+ return;
453
+ }
454
+ const floatingMenuElement = menuEl.current;
455
+ floatingMenuElement.style.visibility = "hidden";
456
+ floatingMenuElement.style.position = "absolute";
457
+ const plugin = (0, import_extension_floating_menu.FloatingMenuPlugin)({
458
+ ...floatingMenuPluginPropsRef.current,
459
+ editor: pluginEditor,
460
+ element: floatingMenuElement
461
+ });
462
+ pluginEditor.registerPlugin(plugin);
463
+ const createdPluginKey = floatingMenuPluginPropsRef.current.pluginKey;
464
+ skipFirstUpdateRef.current = true;
465
+ setPluginInitialized(true);
466
+ return () => {
467
+ setPluginInitialized(false);
468
+ pluginEditor.unregisterPlugin(createdPluginKey);
469
+ window.requestAnimationFrame(() => {
470
+ if (floatingMenuElement.parentNode) {
471
+ floatingMenuElement.parentNode.removeChild(floatingMenuElement);
472
+ }
473
+ });
474
+ };
475
+ }, [pluginEditor]);
476
+ (0, import_react5.useEffect)(() => {
477
+ if (!pluginInitialized || !pluginEditor || pluginEditor.isDestroyed) {
478
+ return;
479
+ }
480
+ if (skipFirstUpdateRef.current) {
481
+ skipFirstUpdateRef.current = false;
482
+ return;
483
+ }
484
+ pluginEditor.view.dispatch(
485
+ pluginEditor.state.tr.setMeta(resolvedPluginKey, {
486
+ type: "updateOptions",
487
+ options: floatingMenuPluginPropsRef.current
488
+ })
489
+ );
490
+ }, [pluginInitialized, pluginEditor, updateDelay, resizeDelay, shouldShow, options, appendTo, resolvedPluginKey]);
491
+ return (0, import_react_dom2.createPortal)(children, menuEl.current);
492
+ }
493
+ );
494
+ // Annotate the CommonJS export names for ESM import in node:
495
+ 0 && (module.exports = {
496
+ BubbleMenu,
497
+ FloatingMenu
498
+ });
499
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/menus/index.ts","../../src/menus/BubbleMenu.tsx","../../src/menus/getAutoPluginKey.ts","../../src/menus/useMenuElementProps.ts","../../src/menus/FloatingMenu.tsx"],"sourcesContent":["export * from './BubbleMenu.js'\nexport * from './FloatingMenu.js'\n","import { type BubbleMenuPluginProps, BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'\nimport type { PluginKey } from '@tiptap/pm/state'\nimport { useCurrentEditor } from '@tiptap/react'\nimport React, { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { getAutoPluginKey } from './getAutoPluginKey.js'\nimport { useMenuElementProps } from './useMenuElementProps.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type BubbleMenuProps = Optional<Omit<Optional<BubbleMenuPluginProps, 'pluginKey'>, 'element'>, 'editor'> &\n React.HTMLAttributes<HTMLDivElement>\n\nexport const BubbleMenu = React.forwardRef<HTMLDivElement, BubbleMenuProps>(\n (\n {\n pluginKey,\n editor,\n updateDelay,\n resizeDelay,\n appendTo,\n shouldShow = null,\n getReferencedVirtualElement,\n options,\n children,\n ...restProps\n },\n ref,\n ) => {\n const menuEl = useRef(document.createElement('div'))\n const resolvedPluginKey = useRef<PluginKey | string>(getAutoPluginKey(pluginKey, 'bubbleMenu')).current\n\n useMenuElementProps(menuEl.current, restProps)\n\n if (typeof ref === 'function') {\n ref(menuEl.current)\n } else if (ref) {\n ref.current = menuEl.current\n }\n\n const { editor: currentEditor } = useCurrentEditor()\n\n /**\n * The editor instance where the bubble menu plugin will be registered.\n */\n const pluginEditor = editor || currentEditor\n\n // Creating a useMemo would be more computationally expensive than just\n // re-creating this object on every render.\n const bubbleMenuPluginProps: Omit<BubbleMenuPluginProps, 'editor' | 'element'> = {\n updateDelay,\n resizeDelay,\n appendTo,\n pluginKey: resolvedPluginKey,\n shouldShow,\n getReferencedVirtualElement,\n options,\n }\n /**\n * The props for the bubble menu plugin. They are accessed inside a ref to\n * avoid running the useEffect hook and re-registering the plugin when the\n * props change.\n */\n const bubbleMenuPluginPropsRef = useRef(bubbleMenuPluginProps)\n bubbleMenuPluginPropsRef.current = bubbleMenuPluginProps\n\n /**\n * Track whether the plugin has been initialized, so we only send updates\n * after the initial registration.\n */\n const [pluginInitialized, setPluginInitialized] = useState(false)\n\n /**\n * Track whether we need to skip the first options update dispatch.\n * This prevents unnecessary updates right after plugin initialization.\n */\n const skipFirstUpdateRef = useRef(true)\n\n useEffect(() => {\n if (pluginEditor?.isDestroyed) {\n return\n }\n\n if (!pluginEditor) {\n console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const bubbleMenuElement = menuEl.current\n bubbleMenuElement.style.visibility = 'hidden'\n bubbleMenuElement.style.position = 'absolute'\n\n const plugin = BubbleMenuPlugin({\n ...bubbleMenuPluginPropsRef.current,\n editor: pluginEditor,\n element: bubbleMenuElement,\n })\n\n pluginEditor.registerPlugin(plugin)\n\n const createdPluginKey = bubbleMenuPluginPropsRef.current.pluginKey\n\n skipFirstUpdateRef.current = true\n setPluginInitialized(true)\n\n return () => {\n setPluginInitialized(false)\n pluginEditor.unregisterPlugin(createdPluginKey)\n window.requestAnimationFrame(() => {\n if (bubbleMenuElement.parentNode) {\n bubbleMenuElement.parentNode.removeChild(bubbleMenuElement)\n }\n })\n }\n }, [pluginEditor])\n\n /**\n * Update the plugin options when props change after the plugin has been initialized.\n * This allows dynamic updates to options like scrollTarget without re-registering the entire plugin.\n */\n useEffect(() => {\n if (!pluginInitialized || !pluginEditor || pluginEditor.isDestroyed) {\n return\n }\n\n // Skip the first update right after initialization since the plugin was just created with these options\n if (skipFirstUpdateRef.current) {\n skipFirstUpdateRef.current = false\n return\n }\n\n pluginEditor.view.dispatch(\n pluginEditor.state.tr.setMeta(resolvedPluginKey, {\n type: 'updateOptions',\n options: bubbleMenuPluginPropsRef.current,\n }),\n )\n }, [\n pluginInitialized,\n pluginEditor,\n updateDelay,\n resizeDelay,\n shouldShow,\n options,\n appendTo,\n getReferencedVirtualElement,\n resolvedPluginKey,\n ])\n\n return createPortal(children, menuEl.current)\n },\n)\n","import { PluginKey } from '@tiptap/pm/state'\n\nexport function getAutoPluginKey(pluginKey: PluginKey | string | undefined, defaultName: string) {\n return pluginKey ?? new PluginKey(defaultName)\n}\n","import type { CSSProperties, HTMLAttributes } from 'react'\nimport { useEffect, useLayoutEffect, useRef } from 'react'\n\nconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect\n\ntype MenuElementProps = HTMLAttributes<HTMLDivElement>\ntype MenuSyntheticEvent = Event & {\n nativeEvent: Event\n currentTarget: HTMLDivElement\n target: EventTarget | null\n persist: () => void\n isDefaultPrevented: () => boolean\n isPropagationStopped: () => boolean\n}\ntype MenuEventListener = (event: MenuSyntheticEvent) => void\ntype MenuNativeListener = (event: Event) => void\ntype MenuEventListenerOptions = {\n capture?: boolean\n}\n\ntype EventListenerEntry = {\n eventName: string\n listener: MenuNativeListener\n options?: MenuEventListenerOptions\n}\n\nconst PLUGIN_MANAGED_STYLE_PROPERTIES = new Set(['left', 'opacity', 'position', 'top', 'visibility', 'width'])\nconst UNITLESS_STYLE_PROPERTIES = new Set([\n 'animationIterationCount',\n 'aspectRatio',\n 'borderImageOutset',\n 'borderImageSlice',\n 'borderImageWidth',\n 'columnCount',\n 'columns',\n 'fillOpacity',\n 'flex',\n 'flexGrow',\n 'flexShrink',\n 'fontWeight',\n 'gridArea',\n 'gridColumn',\n 'gridColumnEnd',\n 'gridColumnStart',\n 'gridRow',\n 'gridRowEnd',\n 'gridRowStart',\n 'lineClamp',\n 'lineHeight',\n 'opacity',\n 'order',\n 'orphans',\n 'scale',\n 'stopOpacity',\n 'strokeDasharray',\n 'strokeDashoffset',\n 'strokeMiterlimit',\n 'strokeOpacity',\n 'strokeWidth',\n 'tabSize',\n 'widows',\n 'zIndex',\n 'zoom',\n])\nconst ATTRIBUTE_EXCLUSIONS = new Set(['children', 'className', 'style'])\nconst DIRECT_PROPERTY_KEYS = new Set(['tabIndex'])\nconst FORWARDED_ATTRIBUTE_KEYS = new Set([\n 'accessKey',\n 'autoCapitalize',\n 'contentEditable',\n 'contextMenu',\n 'dir',\n 'draggable',\n 'enterKeyHint',\n 'hidden',\n 'id',\n 'lang',\n 'nonce',\n 'role',\n 'slot',\n 'spellCheck',\n 'tabIndex',\n 'title',\n 'translate',\n])\nconst SPECIAL_EVENT_NAMES: Record<string, string> = {\n Blur: 'focusout',\n DoubleClick: 'dblclick',\n Focus: 'focusin',\n MouseEnter: 'mouseenter',\n MouseLeave: 'mouseleave',\n}\n\nfunction isEventProp(key: string, value: unknown): value is MenuEventListener {\n return /^on[A-Z]/.test(key) && typeof value === 'function'\n}\n\nfunction toAttributeName(key: string) {\n if (key.startsWith('aria-') || key.startsWith('data-')) {\n return key\n }\n\n return key\n}\n\nfunction isForwardedAttributeKey(key: string) {\n return key.startsWith('aria-') || key.startsWith('data-') || FORWARDED_ATTRIBUTE_KEYS.has(key)\n}\n\nfunction toStylePropertyName(key: string) {\n if (key.startsWith('--')) {\n return key\n }\n\n return key.replace(/[A-Z]/g, match => `-${match.toLowerCase()}`)\n}\n\nfunction toEventConfig(key: string) {\n const useCapture = key.endsWith('Capture')\n const baseKey = useCapture ? key.slice(0, -7) : key\n const reactEventName = baseKey.slice(2)\n const eventName = SPECIAL_EVENT_NAMES[reactEventName] ?? reactEventName.toLowerCase()\n\n return {\n eventName,\n options: useCapture ? { capture: true } : undefined,\n }\n}\n\nfunction createSyntheticEvent(element: HTMLDivElement, nativeEvent: Event): MenuSyntheticEvent {\n let defaultPrevented = nativeEvent.defaultPrevented\n let propagationStopped = false\n const syntheticEvent = Object.create(nativeEvent)\n\n Object.defineProperties(syntheticEvent, {\n nativeEvent: { value: nativeEvent },\n currentTarget: { value: element },\n target: { value: nativeEvent.target },\n persist: { value: () => undefined },\n isDefaultPrevented: { value: () => defaultPrevented },\n isPropagationStopped: { value: () => propagationStopped },\n preventDefault: {\n value: () => {\n defaultPrevented = true\n nativeEvent.preventDefault()\n },\n },\n stopPropagation: {\n value: () => {\n propagationStopped = true\n nativeEvent.stopPropagation()\n },\n },\n })\n\n return syntheticEvent as MenuSyntheticEvent\n}\n\nfunction isDirectPropertyKey(key: string) {\n return DIRECT_PROPERTY_KEYS.has(key)\n}\n\nfunction setDirectProperty(element: HTMLDivElement, key: string, value: unknown) {\n if (key === 'tabIndex') {\n element.tabIndex = Number(value)\n return\n }\n\n ;(element as unknown as Record<string, unknown>)[key] = value\n}\n\nfunction clearDirectProperty(element: HTMLDivElement, key: string) {\n if (key === 'tabIndex') {\n element.removeAttribute('tabindex')\n return\n }\n\n const propertyValue = (element as unknown as Record<string, unknown>)[key]\n\n if (typeof propertyValue === 'boolean') {\n ;(element as unknown as Record<string, unknown>)[key] = false\n return\n }\n\n if (typeof propertyValue === 'number') {\n ;(element as unknown as Record<string, unknown>)[key] = 0\n return\n }\n\n ;(element as unknown as Record<string, unknown>)[key] = ''\n}\n\nfunction toStyleValue(styleName: string, value: string | number) {\n if (\n typeof value !== 'number' ||\n value === 0 ||\n styleName.startsWith('--') ||\n UNITLESS_STYLE_PROPERTIES.has(styleName)\n ) {\n return String(value)\n }\n\n return `${value}px`\n}\n\nfunction removeStyleProperty(element: HTMLDivElement, styleName: string) {\n if (PLUGIN_MANAGED_STYLE_PROPERTIES.has(styleName)) {\n return\n }\n\n element.style.removeProperty(toStylePropertyName(styleName))\n}\n\nfunction applyStyleProperty(element: HTMLDivElement, styleName: string, value: string | number) {\n if (PLUGIN_MANAGED_STYLE_PROPERTIES.has(styleName)) {\n return\n }\n\n element.style.setProperty(toStylePropertyName(styleName), toStyleValue(styleName, value))\n}\n\nfunction syncAttributes(element: HTMLDivElement, prevProps: MenuElementProps, nextProps: MenuElementProps) {\n const allKeys = new Set([...Object.keys(prevProps), ...Object.keys(nextProps)])\n\n allKeys.forEach(key => {\n if (\n ATTRIBUTE_EXCLUSIONS.has(key) ||\n !isForwardedAttributeKey(key) ||\n isEventProp(key, prevProps[key as keyof MenuElementProps]) ||\n isEventProp(key, nextProps[key as keyof MenuElementProps])\n ) {\n return\n }\n\n const prevValue = prevProps[key as keyof MenuElementProps]\n const nextValue = nextProps[key as keyof MenuElementProps]\n\n if (prevValue === nextValue) {\n return\n }\n\n const attributeName = toAttributeName(key)\n\n if (nextValue == null || nextValue === false) {\n if (isDirectPropertyKey(key)) {\n clearDirectProperty(element, key)\n }\n\n element.removeAttribute(attributeName)\n return\n }\n\n if (nextValue === true) {\n if (isDirectPropertyKey(key)) {\n setDirectProperty(element, key, true)\n }\n\n element.setAttribute(attributeName, '')\n return\n }\n\n if (isDirectPropertyKey(key)) {\n setDirectProperty(element, key, nextValue)\n return\n }\n\n element.setAttribute(attributeName, String(nextValue))\n })\n}\n\nfunction syncClassName(element: HTMLDivElement, prevClassName?: string, nextClassName?: string) {\n if (prevClassName === nextClassName) {\n return\n }\n\n if (nextClassName) {\n element.className = nextClassName\n return\n }\n\n element.removeAttribute('class')\n}\n\nfunction syncStyles(\n element: HTMLDivElement,\n prevStyle: CSSProperties | undefined,\n nextStyle: CSSProperties | undefined,\n) {\n const previousStyle = prevStyle ?? {}\n const currentStyle = nextStyle ?? {}\n const allStyleNames = new Set([...Object.keys(previousStyle), ...Object.keys(currentStyle)])\n\n allStyleNames.forEach(styleName => {\n const prevValue = previousStyle[styleName as keyof CSSProperties]\n const nextValue = currentStyle[styleName as keyof CSSProperties]\n\n if (prevValue === nextValue) {\n return\n }\n\n if (nextValue == null) {\n removeStyleProperty(element, styleName)\n return\n }\n\n applyStyleProperty(element, styleName, nextValue as string | number)\n })\n}\n\nfunction syncEventListeners(element: HTMLDivElement, prevListeners: EventListenerEntry[], nextProps: MenuElementProps) {\n prevListeners.forEach(({ eventName, listener, options }) => {\n element.removeEventListener(eventName, listener, options)\n })\n\n const nextListeners: EventListenerEntry[] = []\n\n Object.entries(nextProps).forEach(([key, value]) => {\n if (!isEventProp(key, value)) {\n return\n }\n\n const { eventName, options } = toEventConfig(key)\n const listener: MenuNativeListener = event => {\n value(createSyntheticEvent(element, event))\n }\n\n element.addEventListener(eventName, listener, options)\n nextListeners.push({ eventName, listener, options })\n })\n\n return nextListeners\n}\n\nexport function useMenuElementProps(element: HTMLDivElement, props: MenuElementProps) {\n const previousPropsRef = useRef<MenuElementProps>({})\n const listenersRef = useRef<EventListenerEntry[]>([])\n\n useIsomorphicLayoutEffect(() => {\n const previousProps = previousPropsRef.current\n\n syncClassName(element, previousProps.className, props.className)\n syncStyles(element, previousProps.style, props.style)\n syncAttributes(element, previousProps, props)\n listenersRef.current = syncEventListeners(element, listenersRef.current, props)\n previousPropsRef.current = props\n\n return () => {\n listenersRef.current.forEach(({ eventName, listener, options }) => {\n element.removeEventListener(eventName, listener, options)\n })\n listenersRef.current = []\n }\n }, [element, props])\n}\n","import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'\nimport type { PluginKey } from '@tiptap/pm/state'\nimport { useCurrentEditor } from '@tiptap/react'\nimport React, { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { getAutoPluginKey } from './getAutoPluginKey.js'\nimport { useMenuElementProps } from './useMenuElementProps.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey'>, 'element' | 'editor'> & {\n editor: FloatingMenuPluginProps['editor'] | null\n options?: FloatingMenuPluginProps['options']\n} & React.HTMLAttributes<HTMLDivElement>\n\nexport const FloatingMenu = React.forwardRef<HTMLDivElement, FloatingMenuProps>(\n (\n { pluginKey, editor, updateDelay, resizeDelay, appendTo, shouldShow = null, options, children, ...restProps },\n ref,\n ) => {\n const menuEl = useRef(document.createElement('div'))\n const resolvedPluginKey = useRef<PluginKey | string>(getAutoPluginKey(pluginKey, 'floatingMenu')).current\n\n useMenuElementProps(menuEl.current, restProps)\n\n if (typeof ref === 'function') {\n ref(menuEl.current)\n } else if (ref) {\n ref.current = menuEl.current\n }\n\n const { editor: currentEditor } = useCurrentEditor()\n\n /**\n * The editor instance where the floating menu plugin will be registered.\n */\n const pluginEditor = editor || currentEditor\n\n // Creating a useMemo would be more computationally expensive than just\n // re-creating this object on every render.\n const floatingMenuPluginProps: Omit<FloatingMenuPluginProps, 'editor' | 'element'> = {\n updateDelay,\n resizeDelay,\n appendTo,\n pluginKey: resolvedPluginKey,\n shouldShow,\n options,\n }\n\n /**\n * The props for the floating menu plugin. They are accessed inside a ref to\n * avoid running the useEffect hook and re-registering the plugin when the\n * props change.\n */\n const floatingMenuPluginPropsRef = useRef(floatingMenuPluginProps)\n floatingMenuPluginPropsRef.current = floatingMenuPluginProps\n\n /**\n * Track whether the plugin has been initialized, so we only send updates\n * after the initial registration.\n */\n const [pluginInitialized, setPluginInitialized] = useState(false)\n\n /**\n * Track whether we need to skip the first options update dispatch.\n * This prevents unnecessary updates right after plugin initialization.\n */\n const skipFirstUpdateRef = useRef(true)\n\n useEffect(() => {\n if (pluginEditor?.isDestroyed) {\n return\n }\n\n if (!pluginEditor) {\n console.warn(\n 'FloatingMenu component is not rendered inside of an editor component or does not have editor prop.',\n )\n return\n }\n\n const floatingMenuElement = menuEl.current\n floatingMenuElement.style.visibility = 'hidden'\n floatingMenuElement.style.position = 'absolute'\n\n const plugin = FloatingMenuPlugin({\n ...floatingMenuPluginPropsRef.current,\n editor: pluginEditor,\n element: floatingMenuElement,\n })\n\n pluginEditor.registerPlugin(plugin)\n\n const createdPluginKey = floatingMenuPluginPropsRef.current.pluginKey\n\n skipFirstUpdateRef.current = true\n setPluginInitialized(true)\n\n return () => {\n setPluginInitialized(false)\n pluginEditor.unregisterPlugin(createdPluginKey)\n window.requestAnimationFrame(() => {\n if (floatingMenuElement.parentNode) {\n floatingMenuElement.parentNode.removeChild(floatingMenuElement)\n }\n })\n }\n }, [pluginEditor])\n\n /**\n * Update the plugin options when props change after the plugin has been initialized.\n * This allows dynamic updates to options like scrollTarget without re-registering the entire plugin.\n */\n useEffect(() => {\n if (!pluginInitialized || !pluginEditor || pluginEditor.isDestroyed) {\n return\n }\n\n // Skip the first update right after initialization since the plugin was just created with these options\n if (skipFirstUpdateRef.current) {\n skipFirstUpdateRef.current = false\n return\n }\n\n pluginEditor.view.dispatch(\n pluginEditor.state.tr.setMeta(resolvedPluginKey, {\n type: 'updateOptions',\n options: floatingMenuPluginPropsRef.current,\n }),\n )\n }, [pluginInitialized, pluginEditor, updateDelay, resizeDelay, shouldShow, options, appendTo, resolvedPluginKey])\n\n return createPortal(children, menuEl.current)\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mCAA6D;AAE7D,IAAAA,gBAAiC;AACjC,IAAAA,gBAAmD;AACnD,uBAA6B;;;ACJ7B,mBAA0B;AAEnB,SAAS,iBAAiB,WAA2C,aAAqB;AAC/F,SAAO,gCAAa,IAAI,uBAAU,WAAW;AAC/C;;;ACHA,mBAAmD;AAEnD,IAAM,4BAA4B,OAAO,WAAW,cAAc,+BAAkB;AAuBpF,IAAM,kCAAkC,oBAAI,IAAI,CAAC,QAAQ,WAAW,YAAY,OAAO,cAAc,OAAO,CAAC;AAC7G,IAAM,4BAA4B,oBAAI,IAAI;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AACD,IAAM,uBAAuB,oBAAI,IAAI,CAAC,YAAY,aAAa,OAAO,CAAC;AACvE,IAAM,uBAAuB,oBAAI,IAAI,CAAC,UAAU,CAAC;AACjD,IAAM,2BAA2B,oBAAI,IAAI;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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,oBAAoB,YAAY;AAClC,gCAAoB,WAAW,YAAY,mBAAmB;AAAA,UAChE;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,GAAG,CAAC,YAAY,CAAC;AAMjB,iCAAU,MAAM;AACd,UAAI,CAAC,qBAAqB,CAAC,gBAAgB,aAAa,aAAa;AACnE;AAAA,MACF;AAGA,UAAI,mBAAmB,SAAS;AAC9B,2BAAmB,UAAU;AAC7B;AAAA,MACF;AAEA,mBAAa,KAAK;AAAA,QAChB,aAAa,MAAM,GAAG,QAAQ,mBAAmB;AAAA,UAC/C,MAAM;AAAA,UACN,SAAS,2BAA2B;AAAA,QACtC,CAAC;AAAA,MACH;AAAA,IACF,GAAG,CAAC,mBAAmB,cAAc,aAAa,aAAa,YAAY,SAAS,UAAU,iBAAiB,CAAC;AAEhH,eAAO,gCAAa,UAAU,OAAO,OAAO;AAAA,EAC9C;AACF;","names":["import_react","React","import_react","import_react_dom","React"]}
@@ -0,0 +1,19 @@
1
+ import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
2
+ import React from 'react';
3
+ import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
4
+
5
+ type Optional$1<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
6
+ type BubbleMenuProps = Optional$1<Omit<Optional$1<BubbleMenuPluginProps, 'pluginKey'>, 'element'>, 'editor'> & React.HTMLAttributes<HTMLDivElement>;
7
+ declare const BubbleMenu: React.ForwardRefExoticComponent<Pick<Partial<Omit<Optional$1<BubbleMenuPluginProps, "pluginKey">, "element">>, "editor"> & Omit<Omit<Optional$1<BubbleMenuPluginProps, "pluginKey">, "element">, "editor"> & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
+
9
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
10
+ type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey'>, 'element' | 'editor'> & {
11
+ editor: FloatingMenuPluginProps['editor'] | null;
12
+ options?: FloatingMenuPluginProps['options'];
13
+ } & React.HTMLAttributes<HTMLDivElement>;
14
+ declare const FloatingMenu: React.ForwardRefExoticComponent<Omit<Optional<FloatingMenuPluginProps, "pluginKey">, "editor" | "element"> & {
15
+ editor: FloatingMenuPluginProps["editor"] | null;
16
+ options?: FloatingMenuPluginProps["options"];
17
+ } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
18
+
19
+ export { BubbleMenu, type BubbleMenuProps, FloatingMenu, type FloatingMenuProps };
@@ -0,0 +1,19 @@
1
+ import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
2
+ import React from 'react';
3
+ import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
4
+
5
+ type Optional$1<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
6
+ type BubbleMenuProps = Optional$1<Omit<Optional$1<BubbleMenuPluginProps, 'pluginKey'>, 'element'>, 'editor'> & React.HTMLAttributes<HTMLDivElement>;
7
+ declare const BubbleMenu: React.ForwardRefExoticComponent<Pick<Partial<Omit<Optional$1<BubbleMenuPluginProps, "pluginKey">, "element">>, "editor"> & Omit<Omit<Optional$1<BubbleMenuPluginProps, "pluginKey">, "element">, "editor"> & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
+
9
+ type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
10
+ type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey'>, 'element' | 'editor'> & {
11
+ editor: FloatingMenuPluginProps['editor'] | null;
12
+ options?: FloatingMenuPluginProps['options'];
13
+ } & React.HTMLAttributes<HTMLDivElement>;
14
+ declare const FloatingMenu: React.ForwardRefExoticComponent<Omit<Optional<FloatingMenuPluginProps, "pluginKey">, "editor" | "element"> & {
15
+ editor: FloatingMenuPluginProps["editor"] | null;
16
+ options?: FloatingMenuPluginProps["options"];
17
+ } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
18
+
19
+ export { BubbleMenu, type BubbleMenuProps, FloatingMenu, type FloatingMenuProps };