@tiptap/react 2.0.0-beta.2 → 2.0.0-beta.200
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/README.md +2 -2
- package/dist/packages/react/src/BubbleMenu.d.ts +9 -0
- package/dist/packages/react/src/Editor.d.ts +3 -2
- package/dist/packages/react/src/EditorContent.d.ts +11 -5
- package/dist/packages/react/src/FloatingMenu.d.ts +9 -0
- package/dist/packages/react/src/NodeViewContent.d.ts +6 -0
- package/dist/packages/react/src/NodeViewWrapper.d.ts +6 -0
- package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +15 -0
- package/dist/packages/react/src/ReactRenderer.d.ts +24 -0
- package/dist/packages/react/src/index.d.ts +8 -2
- package/dist/packages/react/src/useEditor.d.ts +2 -1
- package/dist/packages/react/src/useReactNodeView.d.ts +7 -0
- package/dist/tiptap-react.cjs.js +346 -32
- package/dist/tiptap-react.cjs.js.map +1 -1
- package/dist/tiptap-react.esm.js +337 -28
- package/dist/tiptap-react.esm.js.map +1 -1
- package/dist/tiptap-react.umd.js +347 -36
- package/dist/tiptap-react.umd.js.map +1 -1
- package/package.json +18 -9
- package/src/BubbleMenu.tsx +52 -0
- package/src/Editor.ts +4 -2
- package/src/EditorContent.tsx +75 -12
- package/src/FloatingMenu.tsx +52 -0
- package/src/NodeViewContent.tsx +25 -0
- package/src/NodeViewWrapper.tsx +26 -0
- package/src/ReactNodeViewRenderer.tsx +192 -0
- package/src/ReactRenderer.tsx +119 -0
- package/src/index.ts +8 -5
- package/src/useEditor.ts +16 -4
- package/src/useReactNodeView.ts +12 -0
- package/CHANGELOG.md +0 -24
- package/LICENSE.md +0 -21
- package/dist/tiptap-react.bundle.umd.min.js +0 -15
- package/dist/tiptap-react.bundle.umd.min.js.map +0 -1
- package/src/ReactNodeViewRenderer.ts +0 -208
- package/src/ReactRenderer.ts +0 -58
package/dist/tiptap-react.esm.js
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu';
|
|
2
|
+
import React, { useState, useEffect, createContext, useContext } from 'react';
|
|
3
|
+
import { Editor as Editor$1, NodeView } from '@tiptap/core';
|
|
2
4
|
export * from '@tiptap/core';
|
|
3
|
-
import
|
|
5
|
+
import ReactDOM, { flushSync } from 'react-dom';
|
|
6
|
+
import { FloatingMenuPlugin } from '@tiptap/extension-floating-menu';
|
|
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 = {}, shouldShow = null, } = props;
|
|
18
|
+
const plugin = BubbleMenuPlugin({
|
|
19
|
+
pluginKey,
|
|
20
|
+
editor,
|
|
21
|
+
element,
|
|
22
|
+
tippyOptions,
|
|
23
|
+
shouldShow,
|
|
24
|
+
});
|
|
25
|
+
editor.registerPlugin(plugin);
|
|
26
|
+
return () => editor.unregisterPlugin(pluginKey);
|
|
27
|
+
}, [
|
|
28
|
+
props.editor,
|
|
29
|
+
element,
|
|
30
|
+
]);
|
|
31
|
+
return (React.createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
32
|
+
};
|
|
4
33
|
|
|
5
34
|
class Editor extends Editor$1 {
|
|
6
35
|
constructor() {
|
|
@@ -9,52 +38,332 @@ class Editor extends Editor$1 {
|
|
|
9
38
|
}
|
|
10
39
|
}
|
|
11
40
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const [editor, setEditor] = useState(null);
|
|
18
|
-
const forceUpdate = useForceUpdate();
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
const instance = new Editor(options);
|
|
21
|
-
setEditor(instance);
|
|
22
|
-
instance.on('transaction', forceUpdate);
|
|
23
|
-
return () => {
|
|
24
|
-
instance.destroy();
|
|
25
|
-
};
|
|
26
|
-
}, []);
|
|
27
|
-
return editor;
|
|
28
|
-
};
|
|
29
|
-
|
|
41
|
+
const Portals = ({ renderers }) => {
|
|
42
|
+
return (React.createElement(React.Fragment, null, Array.from(renderers).map(([key, renderer]) => {
|
|
43
|
+
return ReactDOM.createPortal(renderer.reactElement, renderer.element, key);
|
|
44
|
+
})));
|
|
45
|
+
};
|
|
30
46
|
class PureEditorContent extends React.Component {
|
|
31
47
|
constructor(props) {
|
|
32
48
|
super(props);
|
|
33
49
|
this.editorContentRef = React.createRef();
|
|
34
50
|
this.state = {
|
|
35
|
-
|
|
51
|
+
renderers: new Map(),
|
|
36
52
|
};
|
|
37
53
|
}
|
|
54
|
+
componentDidMount() {
|
|
55
|
+
this.init();
|
|
56
|
+
}
|
|
38
57
|
componentDidUpdate() {
|
|
58
|
+
this.init();
|
|
59
|
+
}
|
|
60
|
+
init() {
|
|
39
61
|
const { editor } = this.props;
|
|
40
62
|
if (editor && editor.options.element) {
|
|
63
|
+
if (editor.contentComponent) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
41
66
|
const element = this.editorContentRef.current;
|
|
42
|
-
element.
|
|
67
|
+
element.append(...editor.options.element.childNodes);
|
|
43
68
|
editor.setOptions({
|
|
44
69
|
element,
|
|
45
70
|
});
|
|
46
71
|
editor.contentComponent = this;
|
|
47
|
-
|
|
48
|
-
setTimeout(() => {
|
|
49
|
-
editor.createNodeViews();
|
|
50
|
-
}, 0);
|
|
72
|
+
editor.createNodeViews();
|
|
51
73
|
}
|
|
52
74
|
}
|
|
75
|
+
componentWillUnmount() {
|
|
76
|
+
const { editor } = this.props;
|
|
77
|
+
if (!editor) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (!editor.isDestroyed) {
|
|
81
|
+
editor.view.setProps({
|
|
82
|
+
nodeViews: {},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
editor.contentComponent = null;
|
|
86
|
+
if (!editor.options.element.firstChild) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const newElement = document.createElement('div');
|
|
90
|
+
newElement.append(...editor.options.element.childNodes);
|
|
91
|
+
editor.setOptions({
|
|
92
|
+
element: newElement,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
53
95
|
render() {
|
|
54
|
-
|
|
96
|
+
const { editor, ...rest } = this.props;
|
|
97
|
+
return (React.createElement(React.Fragment, null,
|
|
98
|
+
React.createElement("div", { ref: this.editorContentRef, ...rest }),
|
|
99
|
+
React.createElement(Portals, { renderers: this.state.renderers })));
|
|
55
100
|
}
|
|
56
101
|
}
|
|
57
102
|
const EditorContent = React.memo(PureEditorContent);
|
|
58
103
|
|
|
59
|
-
|
|
104
|
+
const FloatingMenu = (props) => {
|
|
105
|
+
const [element, setElement] = useState(null);
|
|
106
|
+
useEffect(() => {
|
|
107
|
+
if (!element) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (props.editor.isDestroyed) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const { pluginKey = 'floatingMenu', editor, tippyOptions = {}, shouldShow = null, } = props;
|
|
114
|
+
const plugin = FloatingMenuPlugin({
|
|
115
|
+
pluginKey,
|
|
116
|
+
editor,
|
|
117
|
+
element,
|
|
118
|
+
tippyOptions,
|
|
119
|
+
shouldShow,
|
|
120
|
+
});
|
|
121
|
+
editor.registerPlugin(plugin);
|
|
122
|
+
return () => editor.unregisterPlugin(pluginKey);
|
|
123
|
+
}, [
|
|
124
|
+
props.editor,
|
|
125
|
+
element,
|
|
126
|
+
]);
|
|
127
|
+
return (React.createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const ReactNodeViewContext = createContext({
|
|
131
|
+
onDragStart: undefined,
|
|
132
|
+
});
|
|
133
|
+
const useReactNodeView = () => useContext(ReactNodeViewContext);
|
|
134
|
+
|
|
135
|
+
const NodeViewContent = props => {
|
|
136
|
+
const Tag = props.as || 'div';
|
|
137
|
+
const { nodeViewContentRef } = useReactNodeView();
|
|
138
|
+
return (React.createElement(Tag, { ...props, ref: nodeViewContentRef, "data-node-view-content": "", style: {
|
|
139
|
+
whiteSpace: 'pre-wrap',
|
|
140
|
+
...props.style,
|
|
141
|
+
} }));
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const NodeViewWrapper = React.forwardRef((props, ref) => {
|
|
145
|
+
const { onDragStart } = useReactNodeView();
|
|
146
|
+
const Tag = props.as || 'div';
|
|
147
|
+
return (React.createElement(Tag, { ...props, ref: ref, "data-node-view-wrapper": "", onDragStart: onDragStart, style: {
|
|
148
|
+
whiteSpace: 'normal',
|
|
149
|
+
...props.style,
|
|
150
|
+
} }));
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
function isClassComponent(Component) {
|
|
154
|
+
return !!(typeof Component === 'function'
|
|
155
|
+
&& Component.prototype
|
|
156
|
+
&& Component.prototype.isReactComponent);
|
|
157
|
+
}
|
|
158
|
+
function isForwardRefComponent(Component) {
|
|
159
|
+
var _a;
|
|
160
|
+
return !!(typeof Component === 'object'
|
|
161
|
+
&& ((_a = Component.$$typeof) === null || _a === void 0 ? void 0 : _a.toString()) === 'Symbol(react.forward_ref)');
|
|
162
|
+
}
|
|
163
|
+
class ReactRenderer {
|
|
164
|
+
constructor(component, { editor, props = {}, as = 'div', className = '', }) {
|
|
165
|
+
this.ref = null;
|
|
166
|
+
this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString();
|
|
167
|
+
this.component = component;
|
|
168
|
+
this.editor = editor;
|
|
169
|
+
this.props = props;
|
|
170
|
+
this.element = document.createElement(as);
|
|
171
|
+
this.element.classList.add('react-renderer');
|
|
172
|
+
if (className) {
|
|
173
|
+
this.element.classList.add(...className.split(' '));
|
|
174
|
+
}
|
|
175
|
+
this.render();
|
|
176
|
+
}
|
|
177
|
+
render() {
|
|
178
|
+
const Component = this.component;
|
|
179
|
+
const props = this.props;
|
|
180
|
+
if (isClassComponent(Component) || isForwardRefComponent(Component)) {
|
|
181
|
+
props.ref = (ref) => {
|
|
182
|
+
this.ref = ref;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
this.reactElement = React.createElement(Component, { ...props });
|
|
186
|
+
queueMicrotask(() => {
|
|
187
|
+
flushSync(() => {
|
|
188
|
+
var _a;
|
|
189
|
+
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
|
|
190
|
+
this.editor.contentComponent.setState({
|
|
191
|
+
renderers: this.editor.contentComponent.state.renderers.set(this.id, this),
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
updateProps(props = {}) {
|
|
198
|
+
this.props = {
|
|
199
|
+
...this.props,
|
|
200
|
+
...props,
|
|
201
|
+
};
|
|
202
|
+
this.render();
|
|
203
|
+
}
|
|
204
|
+
destroy() {
|
|
205
|
+
queueMicrotask(() => {
|
|
206
|
+
flushSync(() => {
|
|
207
|
+
var _a;
|
|
208
|
+
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
|
|
209
|
+
const { renderers } = this.editor.contentComponent.state;
|
|
210
|
+
renderers.delete(this.id);
|
|
211
|
+
this.editor.contentComponent.setState({
|
|
212
|
+
renderers,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
class ReactNodeView extends NodeView {
|
|
221
|
+
mount() {
|
|
222
|
+
const props = {
|
|
223
|
+
editor: this.editor,
|
|
224
|
+
node: this.node,
|
|
225
|
+
decorations: this.decorations,
|
|
226
|
+
selected: false,
|
|
227
|
+
extension: this.extension,
|
|
228
|
+
getPos: () => this.getPos(),
|
|
229
|
+
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
|
230
|
+
deleteNode: () => this.deleteNode(),
|
|
231
|
+
};
|
|
232
|
+
if (!this.component.displayName) {
|
|
233
|
+
const capitalizeFirstChar = (string) => {
|
|
234
|
+
return string.charAt(0).toUpperCase() + string.substring(1);
|
|
235
|
+
};
|
|
236
|
+
this.component.displayName = capitalizeFirstChar(this.extension.name);
|
|
237
|
+
}
|
|
238
|
+
const ReactNodeViewProvider = componentProps => {
|
|
239
|
+
const Component = this.component;
|
|
240
|
+
const onDragStart = this.onDragStart.bind(this);
|
|
241
|
+
const nodeViewContentRef = element => {
|
|
242
|
+
if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {
|
|
243
|
+
element.appendChild(this.contentDOMElement);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
return (React.createElement(ReactNodeViewContext.Provider, { value: { onDragStart, nodeViewContentRef } },
|
|
247
|
+
React.createElement(Component, { ...componentProps })));
|
|
248
|
+
};
|
|
249
|
+
ReactNodeViewProvider.displayName = 'ReactNodeView';
|
|
250
|
+
this.contentDOMElement = this.node.isLeaf
|
|
251
|
+
? null
|
|
252
|
+
: document.createElement(this.node.isInline ? 'span' : 'div');
|
|
253
|
+
if (this.contentDOMElement) {
|
|
254
|
+
// For some reason the whiteSpace prop is not inherited properly in Chrome and Safari
|
|
255
|
+
// With this fix it seems to work fine
|
|
256
|
+
// See: https://github.com/ueberdosis/tiptap/issues/1197
|
|
257
|
+
this.contentDOMElement.style.whiteSpace = 'inherit';
|
|
258
|
+
}
|
|
259
|
+
let as = this.node.isInline ? 'span' : 'div';
|
|
260
|
+
if (this.options.as) {
|
|
261
|
+
as = this.options.as;
|
|
262
|
+
}
|
|
263
|
+
const { className = '' } = this.options;
|
|
264
|
+
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
|
|
265
|
+
editor: this.editor,
|
|
266
|
+
props,
|
|
267
|
+
as,
|
|
268
|
+
className: `node-${this.node.type.name} ${className}`.trim(),
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
get dom() {
|
|
272
|
+
var _a;
|
|
273
|
+
if (this.renderer.element.firstElementChild
|
|
274
|
+
&& !((_a = this.renderer.element.firstElementChild) === null || _a === void 0 ? void 0 : _a.hasAttribute('data-node-view-wrapper'))) {
|
|
275
|
+
throw Error('Please use the NodeViewWrapper component for your node view.');
|
|
276
|
+
}
|
|
277
|
+
return this.renderer.element;
|
|
278
|
+
}
|
|
279
|
+
get contentDOM() {
|
|
280
|
+
if (this.node.isLeaf) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
return this.contentDOMElement;
|
|
284
|
+
}
|
|
285
|
+
update(node, decorations) {
|
|
286
|
+
const updateProps = (props) => {
|
|
287
|
+
this.renderer.updateProps(props);
|
|
288
|
+
};
|
|
289
|
+
if (node.type !== this.node.type) {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
if (typeof this.options.update === 'function') {
|
|
293
|
+
const oldNode = this.node;
|
|
294
|
+
const oldDecorations = this.decorations;
|
|
295
|
+
this.node = node;
|
|
296
|
+
this.decorations = decorations;
|
|
297
|
+
return this.options.update({
|
|
298
|
+
oldNode,
|
|
299
|
+
oldDecorations,
|
|
300
|
+
newNode: node,
|
|
301
|
+
newDecorations: decorations,
|
|
302
|
+
updateProps: () => updateProps({ node, decorations }),
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
if (node === this.node && this.decorations === decorations) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
this.node = node;
|
|
309
|
+
this.decorations = decorations;
|
|
310
|
+
updateProps({ node, decorations });
|
|
311
|
+
return true;
|
|
312
|
+
}
|
|
313
|
+
selectNode() {
|
|
314
|
+
this.renderer.updateProps({
|
|
315
|
+
selected: true,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
deselectNode() {
|
|
319
|
+
this.renderer.updateProps({
|
|
320
|
+
selected: false,
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
destroy() {
|
|
324
|
+
this.renderer.destroy();
|
|
325
|
+
this.contentDOMElement = null;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function ReactNodeViewRenderer(component, options) {
|
|
329
|
+
return (props) => {
|
|
330
|
+
// try to get the parent component
|
|
331
|
+
// this is important for vue devtools to show the component hierarchy correctly
|
|
332
|
+
// maybe it’s `undefined` because <editor-content> isn’t rendered yet
|
|
333
|
+
if (!props.editor.contentComponent) {
|
|
334
|
+
return {};
|
|
335
|
+
}
|
|
336
|
+
return new ReactNodeView(component, props, options);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function useForceUpdate() {
|
|
341
|
+
const [, setValue] = useState(0);
|
|
342
|
+
return () => setValue(value => value + 1);
|
|
343
|
+
}
|
|
344
|
+
const useEditor = (options = {}, deps = []) => {
|
|
345
|
+
const [editor, setEditor] = useState(null);
|
|
346
|
+
const forceUpdate = useForceUpdate();
|
|
347
|
+
useEffect(() => {
|
|
348
|
+
let isMounted = true;
|
|
349
|
+
const instance = new Editor(options);
|
|
350
|
+
setEditor(instance);
|
|
351
|
+
instance.on('transaction', () => {
|
|
352
|
+
requestAnimationFrame(() => {
|
|
353
|
+
requestAnimationFrame(() => {
|
|
354
|
+
if (isMounted) {
|
|
355
|
+
forceUpdate();
|
|
356
|
+
}
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
return () => {
|
|
361
|
+
instance.destroy();
|
|
362
|
+
isMounted = false;
|
|
363
|
+
};
|
|
364
|
+
}, deps);
|
|
365
|
+
return editor;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
export { BubbleMenu, Editor, EditorContent, FloatingMenu, NodeViewContent, NodeViewWrapper, PureEditorContent, ReactNodeViewRenderer, ReactRenderer, useEditor };
|
|
60
369
|
//# sourceMappingURL=tiptap-react.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-react.esm.js","sources":["../src/Editor.ts","../src/useEditor.ts","../src/EditorContent.tsx"],"sourcesContent":["import React from 'react'\nimport { Editor as CoreEditor } from '@tiptap/core'\n\nexport class Editor extends CoreEditor {\n public contentComponent: React.Component | null = null\n}\n","import { useState, useEffect } from 'react'\nimport { EditorOptions } from '@tiptap/core'\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> = {}) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n const forceUpdate = useForceUpdate()\n\n useEffect(() => {\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', forceUpdate)\n\n return () => {\n instance.destroy()\n }\n }, [])\n\n return editor\n}\n","import React from 'react'\nimport { Editor } from './Editor'\n\ntype EditorContentProps = {\n editor: Editor | null\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentProps> {\n editorContentRef: React.RefObject<any>\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n\n this.state = {\n editor: this.props.editor\n }\n }\n\n componentDidUpdate() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n const element = this.editorContentRef.current\n\n element.appendChild(editor.options.element.firstChild)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n // TODO: why setTimeout?\n setTimeout(() => {\n editor.createNodeViews()\n }, 0)\n }\n }\n\n render() {\n return (\n <div ref={this.editorContentRef} />\n )\n }\n}\n\nexport const EditorContent = React.memo(PureEditorContent);\n"],"names":["CoreEditor"],"mappings":";;;;MAGa,MAAO,SAAQA,QAAU;IAAtC;;QACS,qBAAgB,GAA2B,IAAI,CAAA;KACvD;;;ACDD,SAAS,cAAc;IACrB,MAAM,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAEhC,OAAO,MAAM,QAAQ,CAAC,KAAK,IAAI,KAAK,GAAG,CA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;IAED,MAAM;QACJ,QACE,6BAAK,GAAG,EAAE,IAAI,CAAC,gBAAgB,GAAI,EACpC;KACF;CACF;MAEY,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB;;;;"}
|
|
1
|
+
{"version":3,"file":"tiptap-react.esm.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, {\n useEffect, useState,\n} 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}\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',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const plugin = BubbleMenuPlugin({\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 { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent'\n\nexport class Editor extends CoreEditor {\n public contentComponent: React.Component<EditorContentProps, EditorContentState> | null = null\n}\n","import React, { HTMLProps } from 'react'\nimport ReactDOM from 'react-dom'\n\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\n\nconst Portals: React.FC<{ renderers: Map<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Array.from(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(\n renderer.reactElement,\n renderer.element,\n key,\n )\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null,\n}\n\nexport interface EditorContentState {\n renderers: Map<string, ReactRenderer>\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n\n this.state = {\n renderers: new Map(),\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 }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\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 <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'\nimport { flushSync } from 'react-dom'\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}\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 }: 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 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 queueMicrotask(() => {\n flushSync(() => {\n if (this.editor?.contentComponent) {\n this.editor.contentComponent.setState({\n renderers: this.editor.contentComponent.state.renderers.set(\n this.id,\n this,\n ),\n })\n }\n })\n })\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 queueMicrotask(() => {\n flushSync(() => {\n if (this.editor?.contentComponent) {\n const { renderers } = this.editor.contentComponent.state\n\n renderers.delete(this.id)\n\n this.editor.contentComponent.setState({\n renderers,\n })\n }\n })\n })\n }\n}\n","import {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-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}\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 <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\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 })\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: Decoration[]) {\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 { DependencyList, useEffect, useState } 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 const forceUpdate = useForceUpdate()\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":";;;;;;;AAYa,MAAA,UAAU,GAAG,CAAC,KAAsB,KAAI;IACnD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC,CAAA;IAEnE,SAAS,CAAC,MAAK;QACb,IAAI,CAAC,OAAO,EAAE;YACZ,OAAM;AACP,SAAA;AAED,QAAA,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;YAC5B,OAAM;AACP,SAAA;AAED,QAAA,MAAM,EACJ,SAAS,GAAG,YAAY,EACxB,MAAM,EACN,YAAY,GAAG,EAAE,EACjB,UAAU,GAAG,IAAI,GAClB,GAAG,KAAK,CAAA;QAET,MAAM,MAAM,GAAG,gBAAgB,CAAC;YAC9B,SAAS;YACT,MAAM;YACN,OAAO;YACP,YAAY;YACZ,UAAU;AACX,SAAA,CAAC,CAAA;AAEF,QAAA,MAAM,CAAC,cAAc,CAAC,MAAM,CAA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