@tiptap/react 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 +312 -42
- package/dist/menus/index.cjs.map +1 -1
- package/dist/menus/index.js +304 -34
- package/dist/menus/index.js.map +1 -1
- package/package.json +7 -7
- package/src/menus/BubbleMenu.spec.ts +174 -0
- package/src/menus/BubbleMenu.tsx +12 -4
- package/src/menus/FloatingMenu.spec.ts +164 -0
- package/src/menus/FloatingMenu.tsx +12 -15
- package/src/menus/getAutoPluginKey.ts +5 -0
- package/src/menus/useMenuElementProps.ts +354 -0
package/dist/menus/index.cjs
CHANGED
|
@@ -37,13 +37,289 @@ module.exports = __toCommonJS(index_exports);
|
|
|
37
37
|
|
|
38
38
|
// src/menus/BubbleMenu.tsx
|
|
39
39
|
var import_extension_bubble_menu = require("@tiptap/extension-bubble-menu");
|
|
40
|
-
var
|
|
41
|
-
var
|
|
40
|
+
var import_react2 = require("@tiptap/react");
|
|
41
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
42
42
|
var import_react_dom = require("react-dom");
|
|
43
|
-
|
|
44
|
-
|
|
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(
|
|
45
321
|
({
|
|
46
|
-
pluginKey
|
|
322
|
+
pluginKey,
|
|
47
323
|
editor,
|
|
48
324
|
updateDelay,
|
|
49
325
|
resizeDelay,
|
|
@@ -54,28 +330,30 @@ var BubbleMenu = import_react2.default.forwardRef(
|
|
|
54
330
|
children,
|
|
55
331
|
...restProps
|
|
56
332
|
}, ref) => {
|
|
57
|
-
const menuEl = (0,
|
|
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);
|
|
58
336
|
if (typeof ref === "function") {
|
|
59
337
|
ref(menuEl.current);
|
|
60
338
|
} else if (ref) {
|
|
61
339
|
ref.current = menuEl.current;
|
|
62
340
|
}
|
|
63
|
-
const { editor: currentEditor } = (0,
|
|
341
|
+
const { editor: currentEditor } = (0, import_react2.useCurrentEditor)();
|
|
64
342
|
const pluginEditor = editor || currentEditor;
|
|
65
343
|
const bubbleMenuPluginProps = {
|
|
66
344
|
updateDelay,
|
|
67
345
|
resizeDelay,
|
|
68
346
|
appendTo,
|
|
69
|
-
pluginKey,
|
|
347
|
+
pluginKey: resolvedPluginKey,
|
|
70
348
|
shouldShow,
|
|
71
349
|
getReferencedVirtualElement,
|
|
72
350
|
options
|
|
73
351
|
};
|
|
74
|
-
const bubbleMenuPluginPropsRef = (0,
|
|
352
|
+
const bubbleMenuPluginPropsRef = (0, import_react3.useRef)(bubbleMenuPluginProps);
|
|
75
353
|
bubbleMenuPluginPropsRef.current = bubbleMenuPluginProps;
|
|
76
|
-
const [pluginInitialized, setPluginInitialized] = (0,
|
|
77
|
-
const skipFirstUpdateRef = (0,
|
|
78
|
-
(0,
|
|
354
|
+
const [pluginInitialized, setPluginInitialized] = (0, import_react3.useState)(false);
|
|
355
|
+
const skipFirstUpdateRef = (0, import_react3.useRef)(true);
|
|
356
|
+
(0, import_react3.useEffect)(() => {
|
|
79
357
|
if (pluginEditor == null ? void 0 : pluginEditor.isDestroyed) {
|
|
80
358
|
return;
|
|
81
359
|
}
|
|
@@ -105,7 +383,7 @@ var BubbleMenu = import_react2.default.forwardRef(
|
|
|
105
383
|
});
|
|
106
384
|
};
|
|
107
385
|
}, [pluginEditor]);
|
|
108
|
-
(0,
|
|
386
|
+
(0, import_react3.useEffect)(() => {
|
|
109
387
|
if (!pluginInitialized || !pluginEditor || pluginEditor.isDestroyed) {
|
|
110
388
|
return;
|
|
111
389
|
}
|
|
@@ -114,7 +392,7 @@ var BubbleMenu = import_react2.default.forwardRef(
|
|
|
114
392
|
return;
|
|
115
393
|
}
|
|
116
394
|
pluginEditor.view.dispatch(
|
|
117
|
-
pluginEditor.state.tr.setMeta(
|
|
395
|
+
pluginEditor.state.tr.setMeta(resolvedPluginKey, {
|
|
118
396
|
type: "updateOptions",
|
|
119
397
|
options: bubbleMenuPluginPropsRef.current
|
|
120
398
|
})
|
|
@@ -127,51 +405,43 @@ var BubbleMenu = import_react2.default.forwardRef(
|
|
|
127
405
|
shouldShow,
|
|
128
406
|
options,
|
|
129
407
|
appendTo,
|
|
130
|
-
getReferencedVirtualElement
|
|
408
|
+
getReferencedVirtualElement,
|
|
409
|
+
resolvedPluginKey
|
|
131
410
|
]);
|
|
132
|
-
return (0, import_react_dom.createPortal)(
|
|
411
|
+
return (0, import_react_dom.createPortal)(children, menuEl.current);
|
|
133
412
|
}
|
|
134
413
|
);
|
|
135
414
|
|
|
136
415
|
// src/menus/FloatingMenu.tsx
|
|
137
416
|
var import_extension_floating_menu = require("@tiptap/extension-floating-menu");
|
|
138
|
-
var
|
|
139
|
-
var
|
|
417
|
+
var import_react4 = require("@tiptap/react");
|
|
418
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
140
419
|
var import_react_dom2 = require("react-dom");
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
updateDelay,
|
|
147
|
-
resizeDelay,
|
|
148
|
-
appendTo,
|
|
149
|
-
shouldShow = null,
|
|
150
|
-
options,
|
|
151
|
-
children,
|
|
152
|
-
...restProps
|
|
153
|
-
}, ref) => {
|
|
154
|
-
const menuEl = (0, import_react4.useRef)(document.createElement("div"));
|
|
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);
|
|
155
425
|
if (typeof ref === "function") {
|
|
156
426
|
ref(menuEl.current);
|
|
157
427
|
} else if (ref) {
|
|
158
428
|
ref.current = menuEl.current;
|
|
159
429
|
}
|
|
160
|
-
const { editor: currentEditor } = (0,
|
|
430
|
+
const { editor: currentEditor } = (0, import_react4.useCurrentEditor)();
|
|
161
431
|
const pluginEditor = editor || currentEditor;
|
|
162
432
|
const floatingMenuPluginProps = {
|
|
163
433
|
updateDelay,
|
|
164
434
|
resizeDelay,
|
|
165
435
|
appendTo,
|
|
166
|
-
pluginKey,
|
|
436
|
+
pluginKey: resolvedPluginKey,
|
|
167
437
|
shouldShow,
|
|
168
438
|
options
|
|
169
439
|
};
|
|
170
|
-
const floatingMenuPluginPropsRef = (0,
|
|
440
|
+
const floatingMenuPluginPropsRef = (0, import_react5.useRef)(floatingMenuPluginProps);
|
|
171
441
|
floatingMenuPluginPropsRef.current = floatingMenuPluginProps;
|
|
172
|
-
const [pluginInitialized, setPluginInitialized] = (0,
|
|
173
|
-
const skipFirstUpdateRef = (0,
|
|
174
|
-
(0,
|
|
442
|
+
const [pluginInitialized, setPluginInitialized] = (0, import_react5.useState)(false);
|
|
443
|
+
const skipFirstUpdateRef = (0, import_react5.useRef)(true);
|
|
444
|
+
(0, import_react5.useEffect)(() => {
|
|
175
445
|
if (pluginEditor == null ? void 0 : pluginEditor.isDestroyed) {
|
|
176
446
|
return;
|
|
177
447
|
}
|
|
@@ -203,7 +473,7 @@ var FloatingMenu = import_react4.default.forwardRef(
|
|
|
203
473
|
});
|
|
204
474
|
};
|
|
205
475
|
}, [pluginEditor]);
|
|
206
|
-
(0,
|
|
476
|
+
(0, import_react5.useEffect)(() => {
|
|
207
477
|
if (!pluginInitialized || !pluginEditor || pluginEditor.isDestroyed) {
|
|
208
478
|
return;
|
|
209
479
|
}
|
|
@@ -212,13 +482,13 @@ var FloatingMenu = import_react4.default.forwardRef(
|
|
|
212
482
|
return;
|
|
213
483
|
}
|
|
214
484
|
pluginEditor.view.dispatch(
|
|
215
|
-
pluginEditor.state.tr.setMeta(
|
|
485
|
+
pluginEditor.state.tr.setMeta(resolvedPluginKey, {
|
|
216
486
|
type: "updateOptions",
|
|
217
487
|
options: floatingMenuPluginPropsRef.current
|
|
218
488
|
})
|
|
219
489
|
);
|
|
220
|
-
}, [pluginInitialized, pluginEditor, updateDelay, resizeDelay, shouldShow, options, appendTo]);
|
|
221
|
-
return (0, import_react_dom2.createPortal)(
|
|
490
|
+
}, [pluginInitialized, pluginEditor, updateDelay, resizeDelay, shouldShow, options, appendTo, resolvedPluginKey]);
|
|
491
|
+
return (0, import_react_dom2.createPortal)(children, menuEl.current);
|
|
222
492
|
}
|
|
223
493
|
);
|
|
224
494
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/menus/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/menus/index.ts","../../src/menus/BubbleMenu.tsx","../../src/menus/FloatingMenu.tsx"],"sourcesContent":["export * from './BubbleMenu.js'\nexport * from './FloatingMenu.js'\n","import { type BubbleMenuPluginProps, BubbleMenuPlugin } from '@tiptap/extension-bubble-menu'\nimport { useCurrentEditor } from '@tiptap/react'\nimport React, { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\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 = 'bubbleMenu',\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\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,\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(pluginKey, {\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 ])\n\n return createPortal(<div {...restProps}>{children}</div>, menuEl.current)\n },\n)\n","import type { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport { FloatingMenuPlugin } from '@tiptap/extension-floating-menu'\nimport { useCurrentEditor } from '@tiptap/react'\nimport React, { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\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 {\n pluginKey = 'floatingMenu',\n editor,\n updateDelay,\n resizeDelay,\n appendTo,\n shouldShow = null,\n options,\n children,\n ...restProps\n },\n ref,\n ) => {\n const menuEl = useRef(document.createElement('div'))\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,\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(pluginKey, {\n type: 'updateOptions',\n options: floatingMenuPluginPropsRef.current,\n }),\n )\n }, [pluginInitialized, pluginEditor, updateDelay, resizeDelay, shouldShow, options, appendTo])\n\n return createPortal(<div {...restProps}>{children}</div>, menuEl.current)\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mCAA6D;AAC7D,mBAAiC;AACjC,IAAAA,gBAAmD;AACnD,uBAA6B;AA2IL;AApIjB,IAAM,aAAa,cAAAC,QAAM;AAAA,EAC9B,CACE;AAAA,IACE,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,aAAS,sBAAO,SAAS,cAAc,KAAK,CAAC;AAEnD,QAAI,OAAO,QAAQ,YAAY;AAC7B,UAAI,OAAO,OAAO;AAAA,IACpB,WAAW,KAAK;AACd,UAAI,UAAU,OAAO;AAAA,IACvB;AAEA,UAAM,EAAE,QAAQ,cAAc,QAAI,+BAAiB;AAKnD,UAAM,eAAe,UAAU;AAI/B,UAAM,wBAA2E;AAAA,MAC/E;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAMA,UAAM,+BAA2B,sBAAO,qBAAqB;AAC7D,6BAAyB,UAAU;AAMnC,UAAM,CAAC,mBAAmB,oBAAoB,QAAI,wBAAS,KAAK;AAMhE,UAAM,yBAAqB,sBAAO,IAAI;AAEtC,iCAAU,MAAM;AACd,UAAI,6CAAc,aAAa;AAC7B;AAAA,MACF;AAEA,UAAI,CAAC,cAAc;AACjB,gBAAQ,KAAK,kGAAkG;AAC/G;AAAA,MACF;AAEA,YAAM,oBAAoB,OAAO;AACjC,wBAAkB,MAAM,aAAa;AACrC,wBAAkB,MAAM,WAAW;AAEnC,YAAM,aAAS,+CAAiB;AAAA,QAC9B,GAAG,yBAAyB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AC7B;AAAA,MACF;AAEA,mBAAa,KAAK;AAAA,QAChB,aAAa,MAAM,GAAG,QAAQ,WAAW;AAAA,UACvC,MAAM;AAAA,UACN,SAAS,2BAA2B;AAAA,QACtC,CAAC;AAAA,MACH;AAAA,IACF,GAAG,CAAC,mBAAmB,cAAc,aAAa,aAAa,YAAY,SAAS,QAAQ,CAAC;AAE7F,eAAO,gCAAa,6CAAC,SAAK,GAAG,WAAY,UAAS,GAAQ,OAAO,OAAO;AAAA,EAC1E;AACF;","names":["import_react","React","import_react","import_react_dom","import_jsx_runtime","React"]}
|
|
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;AAA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