@tiptap/react 2.1.0-rc.8 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +181 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +179 -123
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +184 -124
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/react/src/BubbleMenu.d.ts +2 -2
- package/dist/packages/react/src/Context.d.ts +15 -0
- package/dist/packages/react/src/Editor.d.ts +2 -2
- package/dist/packages/react/src/EditorContent.d.ts +4 -4
- package/dist/packages/react/src/FloatingMenu.d.ts +2 -2
- package/dist/packages/react/src/ReactRenderer.d.ts +1 -1
- package/dist/packages/react/src/index.d.ts +10 -9
- package/dist/packages/react/src/useEditor.d.ts +1 -1
- package/package.json +7 -7
- package/src/BubbleMenu.tsx +16 -6
- package/src/Context.tsx +47 -0
- package/src/Editor.ts +2 -2
- package/src/EditorContent.tsx +13 -3
- package/src/FloatingMenu.tsx +16 -5
- package/src/NodeViewContent.tsx +1 -1
- package/src/NodeViewWrapper.tsx +1 -1
- package/src/ReactNodeViewRenderer.tsx +17 -3
- package/src/ReactRenderer.tsx +1 -1
- package/src/index.ts +10 -9
- package/src/useEditor.ts +7 -2
package/dist/index.js
CHANGED
|
@@ -1,41 +1,10 @@
|
|
|
1
1
|
import { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu';
|
|
2
|
-
import React, { useState, useEffect, createContext, useContext
|
|
2
|
+
import React, { useState, useRef, useEffect, createContext, useContext } from 'react';
|
|
3
|
+
import ReactDOM, { flushSync } from 'react-dom';
|
|
3
4
|
import { Editor as Editor$1, NodeView } from '@tiptap/core';
|
|
4
5
|
export * from '@tiptap/core';
|
|
5
|
-
import ReactDOM, { flushSync } from 'react-dom';
|
|
6
6
|
import { FloatingMenuPlugin } from '@tiptap/extension-floating-menu';
|
|
7
7
|
|
|
8
|
-
const BubbleMenu = (props) => {
|
|
9
|
-
const [element, setElement] = useState(null);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (!element) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
if (props.editor.isDestroyed) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const { pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null, } = props;
|
|
18
|
-
const plugin = BubbleMenuPlugin({
|
|
19
|
-
updateDelay,
|
|
20
|
-
editor,
|
|
21
|
-
element,
|
|
22
|
-
pluginKey,
|
|
23
|
-
shouldShow,
|
|
24
|
-
tippyOptions,
|
|
25
|
-
});
|
|
26
|
-
editor.registerPlugin(plugin);
|
|
27
|
-
return () => editor.unregisterPlugin(pluginKey);
|
|
28
|
-
}, [props.editor, element]);
|
|
29
|
-
return (React.createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
class Editor extends Editor$1 {
|
|
33
|
-
constructor() {
|
|
34
|
-
super(...arguments);
|
|
35
|
-
this.contentComponent = null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
8
|
const Portals = ({ renderers }) => {
|
|
40
9
|
return (React.createElement(React.Fragment, null, Object.entries(renderers).map(([key, renderer]) => {
|
|
41
10
|
return ReactDOM.createPortal(renderer.reactElement, renderer.element, key);
|
|
@@ -131,29 +100,188 @@ class PureEditorContent extends React.Component {
|
|
|
131
100
|
React.createElement(Portals, { renderers: this.state.renderers })));
|
|
132
101
|
}
|
|
133
102
|
}
|
|
134
|
-
|
|
103
|
+
// EditorContent should be re-created whenever the Editor instance changes
|
|
104
|
+
const EditorContentWithKey = (props) => {
|
|
105
|
+
const key = React.useMemo(() => {
|
|
106
|
+
return Math.floor(Math.random() * 0xFFFFFFFF).toString();
|
|
107
|
+
}, [props.editor]);
|
|
108
|
+
// Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement
|
|
109
|
+
return React.createElement(PureEditorContent, { key, ...props });
|
|
110
|
+
};
|
|
111
|
+
const EditorContent = React.memo(EditorContentWithKey);
|
|
112
|
+
|
|
113
|
+
class Editor extends Editor$1 {
|
|
114
|
+
constructor() {
|
|
115
|
+
super(...arguments);
|
|
116
|
+
this.contentComponent = null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function useForceUpdate() {
|
|
121
|
+
const [, setValue] = useState(0);
|
|
122
|
+
return () => setValue(value => value + 1);
|
|
123
|
+
}
|
|
124
|
+
const useEditor = (options = {}, deps = []) => {
|
|
125
|
+
const [editor, setEditor] = useState(null);
|
|
126
|
+
const forceUpdate = useForceUpdate();
|
|
127
|
+
const { onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, } = options;
|
|
128
|
+
const onBeforeCreateRef = useRef(onBeforeCreate);
|
|
129
|
+
const onBlurRef = useRef(onBlur);
|
|
130
|
+
const onCreateRef = useRef(onCreate);
|
|
131
|
+
const onDestroyRef = useRef(onDestroy);
|
|
132
|
+
const onFocusRef = useRef(onFocus);
|
|
133
|
+
const onSelectionUpdateRef = useRef(onSelectionUpdate);
|
|
134
|
+
const onTransactionRef = useRef(onTransaction);
|
|
135
|
+
const onUpdateRef = useRef(onUpdate);
|
|
136
|
+
// This effect will handle updating the editor instance
|
|
137
|
+
// when the event handlers change.
|
|
138
|
+
useEffect(() => {
|
|
139
|
+
if (!editor) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (onBeforeCreate) {
|
|
143
|
+
editor.off('beforeCreate', onBeforeCreateRef.current);
|
|
144
|
+
editor.on('beforeCreate', onBeforeCreate);
|
|
145
|
+
onBeforeCreateRef.current = onBeforeCreate;
|
|
146
|
+
}
|
|
147
|
+
if (onBlur) {
|
|
148
|
+
editor.off('blur', onBlurRef.current);
|
|
149
|
+
editor.on('blur', onBlur);
|
|
150
|
+
onBlurRef.current = onBlur;
|
|
151
|
+
}
|
|
152
|
+
if (onCreate) {
|
|
153
|
+
editor.off('create', onCreateRef.current);
|
|
154
|
+
editor.on('create', onCreate);
|
|
155
|
+
onCreateRef.current = onCreate;
|
|
156
|
+
}
|
|
157
|
+
if (onDestroy) {
|
|
158
|
+
editor.off('destroy', onDestroyRef.current);
|
|
159
|
+
editor.on('destroy', onDestroy);
|
|
160
|
+
onDestroyRef.current = onDestroy;
|
|
161
|
+
}
|
|
162
|
+
if (onFocus) {
|
|
163
|
+
editor.off('focus', onFocusRef.current);
|
|
164
|
+
editor.on('focus', onFocus);
|
|
165
|
+
onFocusRef.current = onFocus;
|
|
166
|
+
}
|
|
167
|
+
if (onSelectionUpdate) {
|
|
168
|
+
editor.off('selectionUpdate', onSelectionUpdateRef.current);
|
|
169
|
+
editor.on('selectionUpdate', onSelectionUpdate);
|
|
170
|
+
onSelectionUpdateRef.current = onSelectionUpdate;
|
|
171
|
+
}
|
|
172
|
+
if (onTransaction) {
|
|
173
|
+
editor.off('transaction', onTransactionRef.current);
|
|
174
|
+
editor.on('transaction', onTransaction);
|
|
175
|
+
onTransactionRef.current = onTransaction;
|
|
176
|
+
}
|
|
177
|
+
if (onUpdate) {
|
|
178
|
+
editor.off('update', onUpdateRef.current);
|
|
179
|
+
editor.on('update', onUpdate);
|
|
180
|
+
onUpdateRef.current = onUpdate;
|
|
181
|
+
}
|
|
182
|
+
}, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor]);
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
let isMounted = true;
|
|
185
|
+
const instance = new Editor(options);
|
|
186
|
+
setEditor(instance);
|
|
187
|
+
instance.on('transaction', () => {
|
|
188
|
+
requestAnimationFrame(() => {
|
|
189
|
+
requestAnimationFrame(() => {
|
|
190
|
+
if (isMounted) {
|
|
191
|
+
forceUpdate();
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
return () => {
|
|
197
|
+
isMounted = false;
|
|
198
|
+
};
|
|
199
|
+
}, deps);
|
|
200
|
+
useEffect(() => {
|
|
201
|
+
return () => {
|
|
202
|
+
editor === null || editor === void 0 ? void 0 : editor.destroy();
|
|
203
|
+
};
|
|
204
|
+
}, [editor]);
|
|
205
|
+
return editor;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const EditorContext = createContext({
|
|
209
|
+
editor: null,
|
|
210
|
+
});
|
|
211
|
+
const EditorConsumer = EditorContext.Consumer;
|
|
212
|
+
const useCurrentEditor = () => useContext(EditorContext);
|
|
213
|
+
const EditorProvider = ({ children, slotAfter, slotBefore, ...editorOptions }) => {
|
|
214
|
+
const editor = useEditor(editorOptions);
|
|
215
|
+
if (!editor) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
return (React.createElement(EditorContext.Provider, { value: { editor } },
|
|
219
|
+
slotBefore,
|
|
220
|
+
React.createElement(EditorConsumer, null, ({ editor: currentEditor }) => (React.createElement(EditorContent, { editor: currentEditor }))),
|
|
221
|
+
children,
|
|
222
|
+
slotAfter));
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const BubbleMenu = (props) => {
|
|
226
|
+
const [element, setElement] = useState(null);
|
|
227
|
+
const { editor: currentEditor } = useCurrentEditor();
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
var _a;
|
|
230
|
+
if (!element) {
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (((_a = props.editor) === null || _a === void 0 ? void 0 : _a.isDestroyed) || (currentEditor === null || currentEditor === void 0 ? void 0 : currentEditor.isDestroyed)) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
const { pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null, } = props;
|
|
237
|
+
const menuEditor = editor || currentEditor;
|
|
238
|
+
if (!menuEditor) {
|
|
239
|
+
console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.');
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
const plugin = BubbleMenuPlugin({
|
|
243
|
+
updateDelay,
|
|
244
|
+
editor: menuEditor,
|
|
245
|
+
element,
|
|
246
|
+
pluginKey,
|
|
247
|
+
shouldShow,
|
|
248
|
+
tippyOptions,
|
|
249
|
+
});
|
|
250
|
+
menuEditor.registerPlugin(plugin);
|
|
251
|
+
return () => menuEditor.unregisterPlugin(pluginKey);
|
|
252
|
+
}, [props.editor, currentEditor, element]);
|
|
253
|
+
return (React.createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
254
|
+
};
|
|
135
255
|
|
|
136
256
|
const FloatingMenu = (props) => {
|
|
137
257
|
const [element, setElement] = useState(null);
|
|
258
|
+
const { editor: currentEditor } = useCurrentEditor();
|
|
138
259
|
useEffect(() => {
|
|
260
|
+
var _a;
|
|
139
261
|
if (!element) {
|
|
140
262
|
return;
|
|
141
263
|
}
|
|
142
|
-
if (props.editor.isDestroyed) {
|
|
264
|
+
if (((_a = props.editor) === null || _a === void 0 ? void 0 : _a.isDestroyed) || (currentEditor === null || currentEditor === void 0 ? void 0 : currentEditor.isDestroyed)) {
|
|
143
265
|
return;
|
|
144
266
|
}
|
|
145
267
|
const { pluginKey = 'floatingMenu', editor, tippyOptions = {}, shouldShow = null, } = props;
|
|
268
|
+
const menuEditor = editor || currentEditor;
|
|
269
|
+
if (!menuEditor) {
|
|
270
|
+
console.warn('FloatingMenu component is not rendered inside of an editor component or does not have editor prop.');
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
146
273
|
const plugin = FloatingMenuPlugin({
|
|
147
274
|
pluginKey,
|
|
148
|
-
editor,
|
|
275
|
+
editor: menuEditor,
|
|
149
276
|
element,
|
|
150
277
|
tippyOptions,
|
|
151
278
|
shouldShow,
|
|
152
279
|
});
|
|
153
|
-
|
|
154
|
-
return () =>
|
|
280
|
+
menuEditor.registerPlugin(plugin);
|
|
281
|
+
return () => menuEditor.unregisterPlugin(pluginKey);
|
|
155
282
|
}, [
|
|
156
283
|
props.editor,
|
|
284
|
+
currentEditor,
|
|
157
285
|
element,
|
|
158
286
|
]);
|
|
159
287
|
return (React.createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
@@ -281,6 +409,8 @@ class ReactNodeView extends NodeView {
|
|
|
281
409
|
as = this.options.as;
|
|
282
410
|
}
|
|
283
411
|
const { className = '' } = this.options;
|
|
412
|
+
this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this);
|
|
413
|
+
this.editor.on('selectionUpdate', this.handleSelectionUpdate);
|
|
284
414
|
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
|
|
285
415
|
editor: this.editor,
|
|
286
416
|
props,
|
|
@@ -303,6 +433,15 @@ class ReactNodeView extends NodeView {
|
|
|
303
433
|
}
|
|
304
434
|
return this.contentDOMElement;
|
|
305
435
|
}
|
|
436
|
+
handleSelectionUpdate() {
|
|
437
|
+
const { from, to } = this.editor.state.selection;
|
|
438
|
+
if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {
|
|
439
|
+
this.selectNode();
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
this.deselectNode();
|
|
443
|
+
}
|
|
444
|
+
}
|
|
306
445
|
update(node, decorations) {
|
|
307
446
|
const updateProps = (props) => {
|
|
308
447
|
this.renderer.updateProps(props);
|
|
@@ -343,6 +482,7 @@ class ReactNodeView extends NodeView {
|
|
|
343
482
|
}
|
|
344
483
|
destroy() {
|
|
345
484
|
this.renderer.destroy();
|
|
485
|
+
this.editor.off('selectionUpdate', this.handleSelectionUpdate);
|
|
346
486
|
this.contentDOMElement = null;
|
|
347
487
|
}
|
|
348
488
|
}
|
|
@@ -358,89 +498,5 @@ function ReactNodeViewRenderer(component, options) {
|
|
|
358
498
|
};
|
|
359
499
|
}
|
|
360
500
|
|
|
361
|
-
|
|
362
|
-
const [, setValue] = useState(0);
|
|
363
|
-
return () => setValue(value => value + 1);
|
|
364
|
-
}
|
|
365
|
-
const useEditor = (options = {}, deps = []) => {
|
|
366
|
-
const [editor, setEditor] = useState(null);
|
|
367
|
-
const forceUpdate = useForceUpdate();
|
|
368
|
-
const { onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, } = options;
|
|
369
|
-
const onBeforeCreateRef = useRef(onBeforeCreate);
|
|
370
|
-
const onBlurRef = useRef(onBlur);
|
|
371
|
-
const onCreateRef = useRef(onCreate);
|
|
372
|
-
const onDestroyRef = useRef(onDestroy);
|
|
373
|
-
const onFocusRef = useRef(onFocus);
|
|
374
|
-
const onSelectionUpdateRef = useRef(onSelectionUpdate);
|
|
375
|
-
const onTransactionRef = useRef(onTransaction);
|
|
376
|
-
const onUpdateRef = useRef(onUpdate);
|
|
377
|
-
// This effect will handle updating the editor instance
|
|
378
|
-
// when the event handlers change.
|
|
379
|
-
useEffect(() => {
|
|
380
|
-
if (!editor) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
if (onBeforeCreate) {
|
|
384
|
-
editor.off('beforeCreate', onBeforeCreateRef.current);
|
|
385
|
-
editor.on('beforeCreate', onBeforeCreate);
|
|
386
|
-
onBeforeCreateRef.current = onBeforeCreate;
|
|
387
|
-
}
|
|
388
|
-
if (onBlur) {
|
|
389
|
-
editor.off('blur', onBlurRef.current);
|
|
390
|
-
editor.on('blur', onBlur);
|
|
391
|
-
onBlurRef.current = onBlur;
|
|
392
|
-
}
|
|
393
|
-
if (onCreate) {
|
|
394
|
-
editor.off('create', onCreateRef.current);
|
|
395
|
-
editor.on('create', onCreate);
|
|
396
|
-
onCreateRef.current = onCreate;
|
|
397
|
-
}
|
|
398
|
-
if (onDestroy) {
|
|
399
|
-
editor.off('destroy', onDestroyRef.current);
|
|
400
|
-
editor.on('destroy', onDestroy);
|
|
401
|
-
onDestroyRef.current = onDestroy;
|
|
402
|
-
}
|
|
403
|
-
if (onFocus) {
|
|
404
|
-
editor.off('focus', onFocusRef.current);
|
|
405
|
-
editor.on('focus', onFocus);
|
|
406
|
-
onFocusRef.current = onFocus;
|
|
407
|
-
}
|
|
408
|
-
if (onSelectionUpdate) {
|
|
409
|
-
editor.off('selectionUpdate', onSelectionUpdateRef.current);
|
|
410
|
-
editor.on('selectionUpdate', onSelectionUpdate);
|
|
411
|
-
onSelectionUpdateRef.current = onSelectionUpdate;
|
|
412
|
-
}
|
|
413
|
-
if (onTransaction) {
|
|
414
|
-
editor.off('transaction', onTransactionRef.current);
|
|
415
|
-
editor.on('transaction', onTransaction);
|
|
416
|
-
onTransactionRef.current = onTransaction;
|
|
417
|
-
}
|
|
418
|
-
if (onUpdate) {
|
|
419
|
-
editor.off('update', onUpdateRef.current);
|
|
420
|
-
editor.on('update', onUpdate);
|
|
421
|
-
onUpdateRef.current = onUpdate;
|
|
422
|
-
}
|
|
423
|
-
}, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor]);
|
|
424
|
-
useEffect(() => {
|
|
425
|
-
let isMounted = true;
|
|
426
|
-
const instance = new Editor(options);
|
|
427
|
-
setEditor(instance);
|
|
428
|
-
instance.on('transaction', () => {
|
|
429
|
-
requestAnimationFrame(() => {
|
|
430
|
-
requestAnimationFrame(() => {
|
|
431
|
-
if (isMounted) {
|
|
432
|
-
forceUpdate();
|
|
433
|
-
}
|
|
434
|
-
});
|
|
435
|
-
});
|
|
436
|
-
});
|
|
437
|
-
return () => {
|
|
438
|
-
instance.destroy();
|
|
439
|
-
isMounted = false;
|
|
440
|
-
};
|
|
441
|
-
}, deps);
|
|
442
|
-
return editor;
|
|
443
|
-
};
|
|
444
|
-
|
|
445
|
-
export { BubbleMenu, Editor, EditorContent, FloatingMenu, NodeViewContent, NodeViewWrapper, PureEditorContent, ReactNodeViewRenderer, ReactRenderer, useEditor };
|
|
501
|
+
export { BubbleMenu, Editor, EditorConsumer, EditorContent, EditorContext, EditorProvider, FloatingMenu, NodeViewContent, NodeViewWrapper, PureEditorContent, ReactNodeViewRenderer, ReactRenderer, useCurrentEditor, useEditor };
|
|
446
502
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/BubbleMenu.tsx","../src/Editor.ts","../src/EditorContent.tsx","../src/FloatingMenu.tsx","../src/useReactNodeView.ts","../src/NodeViewContent.tsx","../src/NodeViewWrapper.tsx","../src/ReactRenderer.tsx","../src/ReactNodeViewRenderer.tsx","../src/useEditor.ts"],"sourcesContent":["import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport React, { useEffect, useState } from 'react'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey'>, 'element'> & {\n className?: string;\n children: React.ReactNode;\n updateDelay?: number;\n};\n\nexport const BubbleMenu = (props: BubbleMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null,\n } = props\n\n const plugin = BubbleMenuPlugin({\n updateDelay,\n editor,\n element,\n pluginKey,\n shouldShow,\n tippyOptions,\n })\n\n editor.registerPlugin(plugin)\n return () => editor.unregisterPlugin(pluginKey)\n }, [props.editor, element])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent'\nimport { ReactRenderer } from './ReactRenderer'\n\ntype ContentComponent = React.Component<EditorContentProps, EditorContentState> & {\n setRenderer(id: string, renderer: ReactRenderer): void;\n removeRenderer(id: string): void;\n}\n\nexport class Editor extends CoreEditor {\n public contentComponent: ContentComponent | null = null\n}\n","import React, { HTMLProps } from 'react'\nimport ReactDOM, { flushSync } from 'react-dom'\n\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\n\nconst Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Object.entries(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null;\n}\n\nexport interface EditorContentState {\n renderers: Record<string, ReactRenderer>;\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n initialized: boolean\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n this.initialized = false\n\n this.state = {\n renderers: {},\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n\n this.initialized = true\n }\n }\n\n maybeFlushSync(fn: () => void) {\n // Avoid calling flushSync until the editor is initialized.\n // Initialization happens during the componentDidMount or componentDidUpdate\n // lifecycle methods, and React doesn't allow calling flushSync from inside\n // a lifecycle method.\n if (this.initialized) {\n flushSync(fn)\n } else {\n fn()\n }\n }\n\n setRenderer(id: string, renderer: ReactRenderer) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => ({\n renderers: {\n ...renderers,\n [id]: renderer,\n },\n }))\n })\n }\n\n removeRenderer(id: string) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => {\n const nextRenderers = { ...renderers }\n\n delete nextRenderers[id]\n\n return { renderers: nextRenderers }\n })\n })\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n this.initialized = false\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n {/* @ts-ignore */}\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\nexport const EditorContent = React.memo(PureEditorContent)\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport React, {\n useEffect, useState,\n} from 'react'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey'>, 'element'> & {\n className?: string,\n children: React.ReactNode\n}\n\nexport const FloatingMenu = (props: FloatingMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n editor.registerPlugin(plugin)\n return () => editor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n whiteSpace: 'pre-wrap',\n ...props.style,\n }}\n />\n )\n}\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n whiteSpace: 'normal',\n ...props.style,\n }}\n />\n )\n})\n","import { Editor } from '@tiptap/core'\nimport React from 'react'\n\nimport { Editor as ExtendedEditor } from './Editor'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n attrs?: Record<string, string>,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n attrs,\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n if (attrs) {\n Object.keys(attrs).forEach(key => {\n this.element.setAttribute(key, attrs[key])\n })\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n this.editor?.contentComponent?.setRenderer(this.id, this)\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n this.editor?.contentComponent?.removeRenderer(this.id)\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport React from 'react'\n\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n as?: string\n className?: string\n attrs?: Record<string, string>\n}\n\nclass ReactNodeView extends NodeView<\n React.FunctionComponent,\n Editor,\n ReactNodeViewRendererOptions\n> {\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <>\n {/* @ts-ignore */}\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n {/* @ts-ignore */}\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n </>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n const { className = '' } = this.options\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name} ${className}`.trim(),\n attrs: this.options.attrs,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n destroy() {\n this.renderer.destroy()\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(\n component: any,\n options?: Partial<ReactNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n","import { EditorOptions } from '@tiptap/core'\nimport {\n DependencyList,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Editor } from './Editor'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n\n const forceUpdate = useForceUpdate()\n\n const {\n onBeforeCreate,\n onBlur,\n onCreate,\n onDestroy,\n onFocus,\n onSelectionUpdate,\n onTransaction,\n onUpdate,\n } = options\n\n const onBeforeCreateRef = useRef(onBeforeCreate)\n const onBlurRef = useRef(onBlur)\n const onCreateRef = useRef(onCreate)\n const onDestroyRef = useRef(onDestroy)\n const onFocusRef = useRef(onFocus)\n const onSelectionUpdateRef = useRef(onSelectionUpdate)\n const onTransactionRef = useRef(onTransaction)\n const onUpdateRef = useRef(onUpdate)\n\n // This effect will handle updating the editor instance\n // when the event handlers change.\n useEffect(() => {\n if (!editor) {\n return\n }\n\n if (onBeforeCreate) {\n editor.off('beforeCreate', onBeforeCreateRef.current)\n editor.on('beforeCreate', onBeforeCreate)\n onBeforeCreateRef.current = onBeforeCreate\n }\n\n if (onBlur) {\n editor.off('blur', onBlurRef.current)\n editor.on('blur', onBlur)\n onBlurRef.current = onBlur\n }\n\n if (onCreate) {\n editor.off('create', onCreateRef.current)\n editor.on('create', onCreate)\n onCreateRef.current = onCreate\n }\n\n if (onDestroy) {\n editor.off('destroy', onDestroyRef.current)\n editor.on('destroy', onDestroy)\n onDestroyRef.current = onDestroy\n }\n\n if (onFocus) {\n editor.off('focus', onFocusRef.current)\n editor.on('focus', onFocus)\n onFocusRef.current = onFocus\n }\n\n if (onSelectionUpdate) {\n editor.off('selectionUpdate', onSelectionUpdateRef.current)\n editor.on('selectionUpdate', onSelectionUpdate)\n onSelectionUpdateRef.current = onSelectionUpdate\n }\n\n if (onTransaction) {\n editor.off('transaction', onTransactionRef.current)\n editor.on('transaction', onTransaction)\n onTransactionRef.current = onTransaction\n }\n\n if (onUpdate) {\n editor.off('update', onUpdateRef.current)\n editor.on('update', onUpdate)\n onUpdateRef.current = onUpdate\n }\n }, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor])\n\n useEffect(() => {\n let isMounted = true\n\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (isMounted) {\n forceUpdate()\n }\n })\n })\n })\n\n return () => {\n instance.destroy()\n isMounted = false\n }\n }, deps)\n\n return editor\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;;AAWa,MAAA,UAAU,GAAG,CAAC,KAAsB,KAAI;IACnD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAwB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AE,CAAC,aAAa,EAAE,MAAK;YAC9B,qBAAqB,CAAC,MAAK;gBACzB,qBAAqB,CAAC,MAAK;AACzB,oBAAA,IAAI,SAAS,EAAE;AACb,wBAAA,WAAW,EAAE,CAAA;AACd,qBAAA;AACH,iBAAC,CAAC,CAAA;AACJ,aAAC,CAAC,CAAA;AACJ,SAAC,CAAC,CAAA;AAEF,QAAA,OAAO,MAAK;YACV,QAAQ,CAAC,OAAO,EAAE,CAAA;YAClB,SAAS,GAAG,KAAK,CAAA;AACnB,SAAC,CAAA;KACF,EAAE,IAAI,CAAC,CAAA;AAER,IAAA,OAAO,MAAM,CAAA;AACf;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/EditorContent.tsx","../src/Editor.ts","../src/useEditor.ts","../src/Context.tsx","../src/BubbleMenu.tsx","../src/FloatingMenu.tsx","../src/useReactNodeView.ts","../src/NodeViewContent.tsx","../src/NodeViewWrapper.tsx","../src/ReactRenderer.tsx","../src/ReactNodeViewRenderer.tsx"],"sourcesContent":["import React, { HTMLProps } from 'react'\nimport ReactDOM, { flushSync } from 'react-dom'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\nconst Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Object.entries(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null;\n}\n\nexport interface EditorContentState {\n renderers: Record<string, ReactRenderer>;\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n initialized: boolean\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n this.initialized = false\n\n this.state = {\n renderers: {},\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n\n this.initialized = true\n }\n }\n\n maybeFlushSync(fn: () => void) {\n // Avoid calling flushSync until the editor is initialized.\n // Initialization happens during the componentDidMount or componentDidUpdate\n // lifecycle methods, and React doesn't allow calling flushSync from inside\n // a lifecycle method.\n if (this.initialized) {\n flushSync(fn)\n } else {\n fn()\n }\n }\n\n setRenderer(id: string, renderer: ReactRenderer) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => ({\n renderers: {\n ...renderers,\n [id]: renderer,\n },\n }))\n })\n }\n\n removeRenderer(id: string) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => {\n const nextRenderers = { ...renderers }\n\n delete nextRenderers[id]\n\n return { renderers: nextRenderers }\n })\n })\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n this.initialized = false\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n {/* @ts-ignore */}\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\n// EditorContent should be re-created whenever the Editor instance changes\nconst EditorContentWithKey = (props: EditorContentProps) => {\n const key = React.useMemo(() => {\n return Math.floor(Math.random() * 0xFFFFFFFF).toString()\n }, [props.editor])\n\n // Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement\n return React.createElement(PureEditorContent, { key, ...props })\n}\n\nexport const EditorContent = React.memo(EditorContentWithKey)\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\ntype ContentComponent = React.Component<EditorContentProps, EditorContentState> & {\n setRenderer(id: string, renderer: ReactRenderer): void;\n removeRenderer(id: string): void;\n}\n\nexport class Editor extends CoreEditor {\n public contentComponent: ContentComponent | null = null\n}\n","import { EditorOptions } from '@tiptap/core'\nimport {\n DependencyList,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Editor } from './Editor.js'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n\n const forceUpdate = useForceUpdate()\n\n const {\n onBeforeCreate,\n onBlur,\n onCreate,\n onDestroy,\n onFocus,\n onSelectionUpdate,\n onTransaction,\n onUpdate,\n } = options\n\n const onBeforeCreateRef = useRef(onBeforeCreate)\n const onBlurRef = useRef(onBlur)\n const onCreateRef = useRef(onCreate)\n const onDestroyRef = useRef(onDestroy)\n const onFocusRef = useRef(onFocus)\n const onSelectionUpdateRef = useRef(onSelectionUpdate)\n const onTransactionRef = useRef(onTransaction)\n const onUpdateRef = useRef(onUpdate)\n\n // This effect will handle updating the editor instance\n // when the event handlers change.\n useEffect(() => {\n if (!editor) {\n return\n }\n\n if (onBeforeCreate) {\n editor.off('beforeCreate', onBeforeCreateRef.current)\n editor.on('beforeCreate', onBeforeCreate)\n onBeforeCreateRef.current = onBeforeCreate\n }\n\n if (onBlur) {\n editor.off('blur', onBlurRef.current)\n editor.on('blur', onBlur)\n onBlurRef.current = onBlur\n }\n\n if (onCreate) {\n editor.off('create', onCreateRef.current)\n editor.on('create', onCreate)\n onCreateRef.current = onCreate\n }\n\n if (onDestroy) {\n editor.off('destroy', onDestroyRef.current)\n editor.on('destroy', onDestroy)\n onDestroyRef.current = onDestroy\n }\n\n if (onFocus) {\n editor.off('focus', onFocusRef.current)\n editor.on('focus', onFocus)\n onFocusRef.current = onFocus\n }\n\n if (onSelectionUpdate) {\n editor.off('selectionUpdate', onSelectionUpdateRef.current)\n editor.on('selectionUpdate', onSelectionUpdate)\n onSelectionUpdateRef.current = onSelectionUpdate\n }\n\n if (onTransaction) {\n editor.off('transaction', onTransactionRef.current)\n editor.on('transaction', onTransaction)\n onTransactionRef.current = onTransaction\n }\n\n if (onUpdate) {\n editor.off('update', onUpdateRef.current)\n editor.on('update', onUpdate)\n onUpdateRef.current = onUpdate\n }\n }, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor])\n\n useEffect(() => {\n let isMounted = true\n\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (isMounted) {\n forceUpdate()\n }\n })\n })\n })\n\n return () => {\n isMounted = false\n }\n }, deps)\n\n useEffect(() => {\n return () => {\n editor?.destroy()\n }\n }, [editor])\n\n return editor\n}\n","import { EditorOptions } from '@tiptap/core'\nimport React, { createContext, ReactNode, useContext } from 'react'\n\nimport { Editor } from './Editor.js'\nimport { EditorContent } from './EditorContent.js'\nimport { useEditor } from './useEditor.js'\n\nexport type EditorContextValue = {\n editor: Editor | null;\n}\n\nexport const EditorContext = createContext<EditorContextValue>({\n editor: null,\n})\n\nexport const EditorConsumer = EditorContext.Consumer\n\nexport const useCurrentEditor = () => useContext(EditorContext)\n\nexport type EditorProviderProps = {\n children: ReactNode;\n slotBefore?: ReactNode;\n slotAfter?: ReactNode;\n} & Partial<EditorOptions>\n\nexport const EditorProvider = ({\n children, slotAfter, slotBefore, ...editorOptions\n}: EditorProviderProps) => {\n const editor = useEditor(editorOptions)\n\n if (!editor) {\n return null\n }\n\n return (\n <EditorContext.Provider value={{ editor }}>\n {slotBefore}\n <EditorConsumer>\n {({ editor: currentEditor }) => (\n <EditorContent editor={currentEditor} />\n )}\n </EditorConsumer>\n {children}\n {slotAfter}\n </EditorContext.Provider>\n )\n}\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport React, { useEffect, useState } from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string;\n children: React.ReactNode;\n updateDelay?: number;\n};\n\nexport const BubbleMenu = (props: BubbleMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\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 plugin = BubbleMenuPlugin({\n updateDelay,\n editor: menuEditor,\n element,\n pluginKey,\n shouldShow,\n tippyOptions,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [props.editor, currentEditor, element])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport React, {\n useEffect, useState,\n} from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string,\n children: React.ReactNode\n}\n\nexport const FloatingMenu = (props: FloatingMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('FloatingMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor: menuEditor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n currentEditor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n whiteSpace: 'pre-wrap',\n ...props.style,\n }}\n />\n )\n}\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n whiteSpace: 'normal',\n ...props.style,\n }}\n />\n )\n})\n","import { Editor } from '@tiptap/core'\nimport React from 'react'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n attrs?: Record<string, string>,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n attrs,\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n if (attrs) {\n Object.keys(attrs).forEach(key => {\n this.element.setAttribute(key, attrs[key])\n })\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n this.editor?.contentComponent?.setRenderer(this.id, this)\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n this.editor?.contentComponent?.removeRenderer(this.id)\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport React from 'react'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView.js'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n as?: string\n className?: string\n attrs?: Record<string, string>\n}\n\nclass ReactNodeView extends NodeView<\n React.FunctionComponent,\n Editor,\n ReactNodeViewRendererOptions\n> {\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <>\n {/* @ts-ignore */}\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n {/* @ts-ignore */}\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n </>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n const { className = '' } = this.options\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name} ${className}`.trim(),\n attrs: this.options.attrs,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n\n if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {\n this.selectNode()\n } else {\n this.deselectNode()\n }\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(\n component: any,\n options?: Partial<ReactNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;;AAMA,MAAM,OAAO,GAA2D,CAAC,EAAE,SAAS,EAAE,KAAI;AACxF,IAAA,QACE,KACG,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAI;AACjD,QAAA,OAAO,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;KAC3E,CAAC,CACD,EACJ;AACH,CAAC,CAAA;AAUY,MAAA,iBAAkB,SAAQ,KAAK,CAAC,SAAiD,CAAA;AAK5F,IAAA,WAAA,CAAY,KAAyB,EAAA;QACnC,KAAK,CAAC,KAAK,CAAC,CAAA;AACZ,QAAA,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;AACzC,QAAA,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QAExB,IAAI,CAAC,KAAK,GAAG;AACX,YAAA,SAAS,EAAE,EAAE;SACd,CAAA;KACF;IAED,iBAAiB,GAAA;QACf,IAAI,CAAC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