@tiptap/react 2.0.0-beta.7 → 2.0.0-beta.70
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/LICENSE.md +1 -1
- package/README.md +2 -2
- package/dist/packages/react/src/BubbleMenu.d.ts +3 -1
- package/dist/packages/react/src/EditorContent.d.ts +2 -2
- package/dist/packages/react/src/FloatingMenu.d.ts +8 -0
- package/dist/packages/react/src/NodeViewContent.d.ts +2 -2
- package/dist/packages/react/src/NodeViewWrapper.d.ts +2 -2
- package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +9 -5
- package/dist/packages/react/src/ReactRenderer.d.ts +10 -6
- package/dist/packages/react/src/index.d.ts +1 -0
- package/dist/packages/react/src/useEditor.d.ts +2 -1
- package/dist/packages/react/src/useReactNodeView.d.ts +1 -1
- package/dist/tiptap-react.cjs.js +104 -40
- package/dist/tiptap-react.cjs.js.map +1 -1
- package/dist/tiptap-react.esm.js +105 -42
- package/dist/tiptap-react.esm.js.map +1 -1
- package/dist/tiptap-react.umd.js +107 -44
- package/dist/tiptap-react.umd.js.map +1 -1
- package/package.json +17 -9
- package/src/BubbleMenu.tsx +15 -6
- package/src/EditorContent.tsx +8 -7
- package/src/FloatingMenu.tsx +39 -0
- package/src/NodeViewContent.tsx +16 -9
- package/src/NodeViewWrapper.tsx +11 -9
- package/src/ReactNodeViewRenderer.tsx +70 -23
- package/src/ReactRenderer.tsx +19 -8
- package/src/index.ts +1 -0
- package/src/useEditor.ts +3 -3
- package/src/useReactNodeView.ts +1 -2
- package/CHANGELOG.md +0 -64
- package/dist/tiptap-react.bundle.umd.min.js +0 -54
- package/dist/tiptap-react.bundle.umd.min.js.map +0 -1
package/dist/tiptap-react.esm.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import { Editor as Editor$1, NodeView } from '@tiptap/core';
|
|
2
2
|
export * from '@tiptap/core';
|
|
3
3
|
import React, { useRef, useEffect, useState, createContext, useContext } from 'react';
|
|
4
|
-
import { BubbleMenuPlugin
|
|
4
|
+
import { BubbleMenuPlugin } from '@tiptap/extension-bubble-menu';
|
|
5
|
+
import { FloatingMenuPlugin } from '@tiptap/extension-floating-menu';
|
|
5
6
|
import ReactDOM from 'react-dom';
|
|
6
7
|
|
|
7
8
|
const BubbleMenu = props => {
|
|
8
9
|
const element = useRef(null);
|
|
9
10
|
useEffect(() => {
|
|
10
|
-
const { editor,
|
|
11
|
+
const { pluginKey = 'bubbleMenu', editor, tippyOptions = {}, shouldShow = null, } = props;
|
|
11
12
|
editor.registerPlugin(BubbleMenuPlugin({
|
|
13
|
+
pluginKey,
|
|
12
14
|
editor,
|
|
13
15
|
element: element.current,
|
|
14
|
-
|
|
16
|
+
tippyOptions,
|
|
17
|
+
shouldShow,
|
|
15
18
|
}));
|
|
16
19
|
return () => {
|
|
17
|
-
editor.unregisterPlugin(
|
|
20
|
+
editor.unregisterPlugin(pluginKey);
|
|
18
21
|
};
|
|
19
22
|
}, []);
|
|
20
|
-
return (React.createElement("div", { ref: element, className: props.className }, props.children));
|
|
23
|
+
return (React.createElement("div", { ref: element, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
21
24
|
};
|
|
22
25
|
|
|
23
26
|
class Editor extends Editor$1 {
|
|
@@ -27,11 +30,29 @@ class Editor extends Editor$1 {
|
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
const FloatingMenu = props => {
|
|
34
|
+
const element = useRef(null);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const { pluginKey = 'floatingMenu', editor, tippyOptions = {}, shouldShow = null, } = props;
|
|
37
|
+
editor.registerPlugin(FloatingMenuPlugin({
|
|
38
|
+
pluginKey,
|
|
39
|
+
editor,
|
|
40
|
+
element: element.current,
|
|
41
|
+
tippyOptions,
|
|
42
|
+
shouldShow,
|
|
43
|
+
}));
|
|
44
|
+
return () => {
|
|
45
|
+
editor.unregisterPlugin(pluginKey);
|
|
46
|
+
};
|
|
47
|
+
}, []);
|
|
48
|
+
return (React.createElement("div", { ref: element, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
49
|
+
};
|
|
50
|
+
|
|
30
51
|
function useForceUpdate() {
|
|
31
52
|
const [, setValue] = useState(0);
|
|
32
53
|
return () => setValue(value => value + 1);
|
|
33
54
|
}
|
|
34
|
-
const useEditor = (options = {}) => {
|
|
55
|
+
const useEditor = (options = {}, deps = []) => {
|
|
35
56
|
const [editor, setEditor] = useState(null);
|
|
36
57
|
const forceUpdate = useForceUpdate();
|
|
37
58
|
useEffect(() => {
|
|
@@ -41,7 +62,7 @@ const useEditor = (options = {}) => {
|
|
|
41
62
|
return () => {
|
|
42
63
|
instance.destroy();
|
|
43
64
|
};
|
|
44
|
-
},
|
|
65
|
+
}, deps);
|
|
45
66
|
return editor;
|
|
46
67
|
};
|
|
47
68
|
|
|
@@ -50,14 +71,19 @@ function isClassComponent(Component) {
|
|
|
50
71
|
&& Component.prototype
|
|
51
72
|
&& Component.prototype.isReactComponent);
|
|
52
73
|
}
|
|
74
|
+
function isForwardRefComponent(Component) {
|
|
75
|
+
var _a;
|
|
76
|
+
return !!(typeof Component === 'object'
|
|
77
|
+
&& ((_a = Component.$$typeof) === null || _a === void 0 ? void 0 : _a.toString()) === 'Symbol(react.forward_ref)');
|
|
78
|
+
}
|
|
53
79
|
class ReactRenderer {
|
|
54
|
-
constructor(component, { props = {},
|
|
80
|
+
constructor(component, { editor, props = {}, as = 'div' }) {
|
|
55
81
|
this.ref = null;
|
|
56
82
|
this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString();
|
|
57
83
|
this.component = component;
|
|
58
84
|
this.editor = editor;
|
|
59
85
|
this.props = props;
|
|
60
|
-
this.element = document.createElement(
|
|
86
|
+
this.element = document.createElement(as);
|
|
61
87
|
this.element.classList.add('react-renderer');
|
|
62
88
|
this.render();
|
|
63
89
|
}
|
|
@@ -65,12 +91,12 @@ class ReactRenderer {
|
|
|
65
91
|
var _a;
|
|
66
92
|
const Component = this.component;
|
|
67
93
|
const props = this.props;
|
|
68
|
-
if (isClassComponent(Component)) {
|
|
94
|
+
if (isClassComponent(Component) || isForwardRefComponent(Component)) {
|
|
69
95
|
props.ref = (ref) => {
|
|
70
96
|
this.ref = ref;
|
|
71
97
|
};
|
|
72
98
|
}
|
|
73
|
-
this.reactElement = React.createElement(Component,
|
|
99
|
+
this.reactElement = React.createElement(Component, { ...props });
|
|
74
100
|
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
|
|
75
101
|
this.editor.contentComponent.setState({
|
|
76
102
|
renderers: this.editor.contentComponent.state.renderers.set(this.id, this),
|
|
@@ -97,7 +123,6 @@ class ReactRenderer {
|
|
|
97
123
|
}
|
|
98
124
|
|
|
99
125
|
const ReactNodeViewContext = createContext({
|
|
100
|
-
isEditable: undefined,
|
|
101
126
|
onDragStart: undefined,
|
|
102
127
|
});
|
|
103
128
|
const useReactNodeView = () => useContext(ReactNodeViewContext);
|
|
@@ -112,38 +137,44 @@ class ReactNodeView extends NodeView {
|
|
|
112
137
|
extension: this.extension,
|
|
113
138
|
getPos: () => this.getPos(),
|
|
114
139
|
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
|
140
|
+
deleteNode: () => this.deleteNode(),
|
|
115
141
|
};
|
|
116
142
|
if (!this.component.displayName) {
|
|
117
143
|
const capitalizeFirstChar = (string) => {
|
|
118
144
|
return string.charAt(0).toUpperCase() + string.substring(1);
|
|
119
145
|
};
|
|
120
|
-
|
|
121
|
-
this.component.displayName = capitalizeFirstChar(this.extension.config.name);
|
|
146
|
+
this.component.displayName = capitalizeFirstChar(this.extension.name);
|
|
122
147
|
}
|
|
123
148
|
const ReactNodeViewProvider = componentProps => {
|
|
124
|
-
const [isEditable, setIsEditable] = useState(this.editor.isEditable);
|
|
125
149
|
const onDragStart = this.onDragStart.bind(this);
|
|
126
|
-
const
|
|
150
|
+
const maybeMoveContentDOM = this.maybeMoveContentDOM.bind(this);
|
|
127
151
|
const Component = this.component;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
return () => {
|
|
131
|
-
this.editor.off('viewUpdate', onViewUpdate);
|
|
132
|
-
};
|
|
133
|
-
}, []);
|
|
134
|
-
return (React.createElement(ReactNodeViewContext.Provider, { value: { onDragStart, isEditable } },
|
|
135
|
-
React.createElement(Component, Object.assign({}, componentProps))));
|
|
152
|
+
return (React.createElement(ReactNodeViewContext.Provider, { value: { onDragStart, maybeMoveContentDOM } },
|
|
153
|
+
React.createElement(Component, { ...componentProps })));
|
|
136
154
|
};
|
|
137
155
|
ReactNodeViewProvider.displayName = 'ReactNodeView';
|
|
156
|
+
this.contentDOMElement = this.node.isLeaf
|
|
157
|
+
? null
|
|
158
|
+
: document.createElement(this.node.isInline ? 'span' : 'div');
|
|
159
|
+
if (this.contentDOMElement) {
|
|
160
|
+
// For some reason the whiteSpace prop is not inherited properly in Chrome and Safari
|
|
161
|
+
// With this fix it seems to work fine
|
|
162
|
+
// See: https://github.com/ueberdosis/tiptap/issues/1197
|
|
163
|
+
this.contentDOMElement.style.whiteSpace = 'inherit';
|
|
164
|
+
}
|
|
138
165
|
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
|
|
139
166
|
editor: this.editor,
|
|
140
167
|
props,
|
|
168
|
+
as: this.node.isInline
|
|
169
|
+
? 'span'
|
|
170
|
+
: 'div',
|
|
141
171
|
});
|
|
142
172
|
}
|
|
143
173
|
get dom() {
|
|
144
174
|
var _a;
|
|
145
|
-
if (
|
|
146
|
-
|
|
175
|
+
if (this.renderer.element.firstElementChild
|
|
176
|
+
&& !((_a = this.renderer.element.firstElementChild) === null || _a === void 0 ? void 0 : _a.hasAttribute('data-node-view-wrapper'))) {
|
|
177
|
+
throw Error('Please use the NodeViewWrapper component for your node view.');
|
|
147
178
|
}
|
|
148
179
|
return this.renderer.element;
|
|
149
180
|
}
|
|
@@ -151,12 +182,34 @@ class ReactNodeView extends NodeView {
|
|
|
151
182
|
if (this.node.isLeaf) {
|
|
152
183
|
return null;
|
|
153
184
|
}
|
|
185
|
+
this.maybeMoveContentDOM();
|
|
186
|
+
return this.contentDOMElement;
|
|
187
|
+
}
|
|
188
|
+
maybeMoveContentDOM() {
|
|
154
189
|
const contentElement = this.dom.querySelector('[data-node-view-content]');
|
|
155
|
-
|
|
190
|
+
if (this.contentDOMElement
|
|
191
|
+
&& contentElement
|
|
192
|
+
&& !contentElement.contains(this.contentDOMElement)) {
|
|
193
|
+
contentElement.appendChild(this.contentDOMElement);
|
|
194
|
+
}
|
|
156
195
|
}
|
|
157
196
|
update(node, decorations) {
|
|
197
|
+
const updateProps = (props) => {
|
|
198
|
+
this.renderer.updateProps(props);
|
|
199
|
+
this.maybeMoveContentDOM();
|
|
200
|
+
};
|
|
158
201
|
if (typeof this.options.update === 'function') {
|
|
159
|
-
|
|
202
|
+
const oldNode = this.node;
|
|
203
|
+
const oldDecorations = this.decorations;
|
|
204
|
+
this.node = node;
|
|
205
|
+
this.decorations = decorations;
|
|
206
|
+
return this.options.update({
|
|
207
|
+
oldNode,
|
|
208
|
+
oldDecorations,
|
|
209
|
+
newNode: node,
|
|
210
|
+
newDecorations: decorations,
|
|
211
|
+
updateProps: () => updateProps({ node, decorations }),
|
|
212
|
+
});
|
|
160
213
|
}
|
|
161
214
|
if (node.type !== this.node.type) {
|
|
162
215
|
return false;
|
|
@@ -166,7 +219,7 @@ class ReactNodeView extends NodeView {
|
|
|
166
219
|
}
|
|
167
220
|
this.node = node;
|
|
168
221
|
this.decorations = decorations;
|
|
169
|
-
|
|
222
|
+
updateProps({ node, decorations });
|
|
170
223
|
return true;
|
|
171
224
|
}
|
|
172
225
|
selectNode() {
|
|
@@ -181,6 +234,7 @@ class ReactNodeView extends NodeView {
|
|
|
181
234
|
}
|
|
182
235
|
destroy() {
|
|
183
236
|
this.renderer.destroy();
|
|
237
|
+
this.contentDOMElement = null;
|
|
184
238
|
}
|
|
185
239
|
}
|
|
186
240
|
function ReactNodeViewRenderer(component, options) {
|
|
@@ -221,13 +275,12 @@ class PureEditorContent extends React.Component {
|
|
|
221
275
|
return;
|
|
222
276
|
}
|
|
223
277
|
const element = this.editorContentRef.current;
|
|
224
|
-
element.
|
|
278
|
+
element.append(...editor.options.element.childNodes);
|
|
225
279
|
editor.setOptions({
|
|
226
280
|
element,
|
|
227
281
|
});
|
|
228
282
|
editor.contentComponent = this;
|
|
229
|
-
|
|
230
|
-
setTimeout(() => editor.createNodeViews(), 0);
|
|
283
|
+
editor.createNodeViews();
|
|
231
284
|
}
|
|
232
285
|
}
|
|
233
286
|
componentWillUnmount() {
|
|
@@ -245,30 +298,40 @@ class PureEditorContent extends React.Component {
|
|
|
245
298
|
return;
|
|
246
299
|
}
|
|
247
300
|
const newElement = document.createElement('div');
|
|
248
|
-
newElement.
|
|
301
|
+
newElement.append(...editor.options.element.childNodes);
|
|
249
302
|
editor.setOptions({
|
|
250
303
|
element: newElement,
|
|
251
304
|
});
|
|
252
305
|
}
|
|
253
306
|
render() {
|
|
307
|
+
const { editor, ...rest } = this.props;
|
|
254
308
|
return (React.createElement(React.Fragment, null,
|
|
255
|
-
React.createElement("div", { ref: this.editorContentRef }),
|
|
309
|
+
React.createElement("div", { ref: this.editorContentRef, ...rest }),
|
|
256
310
|
React.createElement(Portals, { renderers: this.state.renderers })));
|
|
257
311
|
}
|
|
258
312
|
}
|
|
259
313
|
const EditorContent = React.memo(PureEditorContent);
|
|
260
314
|
|
|
261
|
-
const NodeViewWrapper = props => {
|
|
315
|
+
const NodeViewWrapper = React.forwardRef((props, ref) => {
|
|
262
316
|
const { onDragStart } = useReactNodeView();
|
|
263
317
|
const Tag = props.as || 'div';
|
|
264
|
-
return (React.createElement(Tag, {
|
|
265
|
-
|
|
318
|
+
return (React.createElement(Tag, { ...props, ref: ref, "data-node-view-wrapper": "", onDragStart: onDragStart, style: {
|
|
319
|
+
...props.style,
|
|
320
|
+
whiteSpace: 'normal',
|
|
321
|
+
} }));
|
|
322
|
+
});
|
|
266
323
|
|
|
267
|
-
const NodeViewContent = props => {
|
|
268
|
-
const { isEditable } = useReactNodeView();
|
|
324
|
+
const NodeViewContent = React.forwardRef((props, ref) => {
|
|
269
325
|
const Tag = props.as || 'div';
|
|
270
|
-
|
|
271
|
-
|
|
326
|
+
const { maybeMoveContentDOM } = useReactNodeView();
|
|
327
|
+
useEffect(() => {
|
|
328
|
+
maybeMoveContentDOM === null || maybeMoveContentDOM === void 0 ? void 0 : maybeMoveContentDOM();
|
|
329
|
+
}, []);
|
|
330
|
+
return (React.createElement(Tag, { ...props, ref: ref, "data-node-view-content": "", style: {
|
|
331
|
+
...props.style,
|
|
332
|
+
whiteSpace: 'pre-wrap',
|
|
333
|
+
} }));
|
|
334
|
+
});
|
|
272
335
|
|
|
273
|
-
export { BubbleMenu, Editor, EditorContent, NodeViewContent, NodeViewWrapper, PureEditorContent, ReactNodeViewRenderer, ReactRenderer, useEditor };
|
|
336
|
+
export { BubbleMenu, Editor, EditorContent, FloatingMenu, NodeViewContent, NodeViewWrapper, PureEditorContent, ReactNodeViewRenderer, ReactRenderer, useEditor };
|
|
274
337
|
//# sourceMappingURL=tiptap-react.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-react.esm.js","sources":["../src/BubbleMenu.tsx","../src/Editor.ts","../src/useEditor.ts","../src/ReactRenderer.tsx","../src/useReactNodeView.ts","../src/ReactNodeViewRenderer.tsx","../src/EditorContent.tsx","../src/NodeViewWrapper.tsx","../src/NodeViewContent.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react'\nimport { BubbleMenuPlugin, BubbleMenuPluginKey, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\n\nexport type BubbleMenuProps = Omit<BubbleMenuPluginProps, 'element'> & {\n className?: string,\n}\n\nexport const BubbleMenu: React.FC<BubbleMenuProps> = props => {\n const element = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const { editor, keepInBounds = true } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n editor,\n element: element.current as HTMLElement,\n keepInBounds,\n }))\n\n return () => {\n editor.unregisterPlugin(BubbleMenuPluginKey)\n }\n }, [])\n\n return (\n <div ref={element} className={props.className}>\n {props.children}\n </div>\n )\n}\n","import React from 'react'\nimport { Editor as CoreEditor } from '@tiptap/core'\nimport { EditorContentProps, EditorContentState } from './EditorContent'\n\nexport class Editor extends CoreEditor {\n public contentComponent: React.Component<EditorContentProps, EditorContentState> | 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 { AnyObject } from '@tiptap/core'\nimport { Editor } from './Editor'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nexport interface ReactRendererOptions {\n as?: string,\n editor: Editor,\n props?: AnyObject,\n}\n\nexport class ReactRenderer {\n id: string\n\n editor: Editor\n\n component: any\n\n element: Element\n\n props: AnyObject\n\n reactElement: React.ReactNode\n\n ref: React.Component | null = null\n\n constructor(component: React.Component | React.FunctionComponent, { props = {}, editor }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor\n this.props = props\n this.element = document.createElement('div')\n this.element.classList.add('react-renderer')\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component)) {\n props.ref = (ref: React.Component) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\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 updateProps(props: AnyObject = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\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","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n isEditable: boolean,\n onDragStart: (event: DragEvent) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n isEditable: undefined,\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React, { useState, useEffect } from 'react'\nimport {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\nimport { ReactNodeViewContext } from './useReactNodeView'\n\ninterface ReactNodeViewRendererOptions {\n stopEvent: ((event: Event) => boolean) | null,\n update: ((node: ProseMirrorNode, decorations: Decoration[]) => boolean) | null,\n}\n\nclass ReactNodeView extends NodeView<React.FunctionComponent, Editor> {\n\n renderer!: ReactRenderer\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 }\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 // @ts-ignore\n this.component.displayName = capitalizeFirstChar(this.extension.config.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const [isEditable, setIsEditable] = useState(this.editor.isEditable)\n const onDragStart = this.onDragStart.bind(this)\n const onViewUpdate = () => setIsEditable(this.editor.isEditable)\n const Component = this.component\n\n useEffect(() => {\n this.editor.on('viewUpdate', onViewUpdate)\n\n return () => {\n this.editor.off('viewUpdate', onViewUpdate)\n }\n }, [])\n\n return (\n <ReactNodeViewContext.Provider value={{ onDragStart, isEditable }}>\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n })\n }\n\n get dom() {\n if (!this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')) {\n throw Error('Please use the ReactViewWrapper component for your node view.')\n }\n\n return this.renderer.element\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n return contentElement || this.dom\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n if (typeof this.options.update === 'function') {\n return this.options.update(node, decorations)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n this.renderer.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 }\n}\n\nexport function ReactNodeViewRenderer(component: any, options?: Partial<ReactNodeViewRendererOptions>): 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 ProseMirrorNodeView\n }\n}\n","import React from 'react'\nimport ReactDOM from 'react-dom'\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 {\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.appendChild(editor.options.element.firstChild)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n // TODO: alternative to setTimeout?\n setTimeout(() => editor.createNodeViews(), 0)\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.appendChild(editor.options.element.firstChild)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n return (\n <>\n <div ref={this.editorContentRef} />\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\nexport const EditorContent = React.memo(PureEditorContent)\n","import React from 'react'\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewWrapperProps {\n className?: string,\n as: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = props => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n className={props.className}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{ whiteSpace: 'normal' }}\n >\n {props.children}\n </Tag>\n )\n}\n","import React from 'react'\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewContentProps {\n className?: string,\n as: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const { isEditable } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n className={props.className}\n data-node-view-content=\"\"\n contentEditable={isEditable}\n style={{ whiteSpace: 'pre-wrap' }}\n />\n )\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;MAOa,UAAU,GAA8B,KAAK;IACxD,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAE5C,SAAS,CAAC;QACR,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,GAAG,KAAK,CAAA;QAE7C,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;YACrC,MAAM;YACN,OAAO,EAAE,OAAO,CAAC,OAAsB;YACvC,YAAY;SACb,CAAC,CAAC,CAAA;QAEH,OAAO;YACL,MAAM,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAA;SAC7C,CAAA;KACF,EAAE,EAAE,CAAC,CAAA;IAEN,QACE,6BAAK,GAAG,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAC1C,KAAK,CAAC,QAAQ,CACX,EACP;AACH;;MCzBa,MAAO,SAAQA,QAAU;IAAtC;;QACS,qBAAgB,GAAmE,IAAI,CAAA;KAC/F;;;ACFD,SAAS,cAAc;IACrB,MAAM,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IAEhC,OAAO,MAAM,QAAQ,CAAC,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,CAAA;AAC3C,CAAC;MAEY,SAAS,GAAG,CAAC,UAAkC,EAAE;IAC5D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAA;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ACnC,oBAAC,OAAO,IAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,GAAI,CAC3C,EACJ;KACF;CACF;MAEY,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,iBAAiB;;MCpG5C,eAAe,GAAmC,KAAK;IAClE,MAAM,EAAE,WAAW,EAAE,GAAG,gBAAgB,EAAE,CAAA;IAC1C,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAA;IAE7B,QACE,oBAAC,GAAG,IACF,SAAS,EAAE,KAAK,CAAC,SAAS,4BACH,EAAE,EACzB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAE/B,KAAK,CAAC,QAAQ,CACV,EACP;AACH;;MCda,eAAe,GAAmC,KAAK;IAClE,MAAM,EAAE,UAAU,EAAE,GAAG,gBAAgB,EAAE,CAAA;IACzC,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAA;IAE7B,QACE,oBAAC,GAAG,IACF,SAAS,EAAE,KAAK,CAAC,SAAS,4BACH,EAAE,EACzB,eAAe,EAAE,UAAU,EAC3B,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,GACjC,EACH;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"tiptap-react.esm.js","sources":["../src/BubbleMenu.tsx","../src/Editor.ts","../src/FloatingMenu.tsx","../src/useEditor.ts","../src/ReactRenderer.tsx","../src/useReactNodeView.ts","../src/ReactNodeViewRenderer.tsx","../src/EditorContent.tsx","../src/NodeViewWrapper.tsx","../src/NodeViewContent.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react'\nimport { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\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}\n\nexport const BubbleMenu: React.FC<BubbleMenuProps> = props => {\n const element = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const {\n pluginKey = 'bubbleMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n editor.registerPlugin(BubbleMenuPlugin({\n pluginKey,\n editor,\n element: element.current as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n\n return () => {\n editor.unregisterPlugin(pluginKey)\n }\n }, [])\n\n return (\n <div ref={element} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import React from 'react'\nimport { Editor as CoreEditor } from '@tiptap/core'\nimport { EditorContentProps, EditorContentState } from './EditorContent'\n\nexport class Editor extends CoreEditor {\n public contentComponent: React.Component<EditorContentProps, EditorContentState> | null = null\n}\n","import React, { useEffect, useRef } from 'react'\nimport { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\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}\n\nexport const FloatingMenu: React.FC<FloatingMenuProps> = props => {\n const element = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n editor.registerPlugin(FloatingMenuPlugin({\n pluginKey,\n editor,\n element: element.current as HTMLElement,\n tippyOptions,\n shouldShow,\n }))\n\n return () => {\n editor.unregisterPlugin(pluginKey)\n }\n }, [])\n\n return (\n <div ref={element} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { useState, useEffect, DependencyList } 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> = {}, deps: DependencyList = []) => {\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 }, deps)\n\n return editor\n}\n","import React from 'react'\nimport { Editor } 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}\n\ntype ComponentType =\n | React.ComponentClass\n | React.FunctionComponent\n | React.ForwardRefExoticComponent<{ items: any[], command: any } & React.RefAttributes<unknown>>\n\nexport class ReactRenderer {\n id: string\n\n editor: Editor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: React.Component | null = null\n\n constructor(component: ComponentType, { editor, props = {}, as = 'div' }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\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: React.Component) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\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 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 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","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n maybeMoveContentDOM: () => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\nimport {\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererProps,\n NodeViewRendererOptions,\n} from '@tiptap/core'\nimport { Decoration, NodeView as ProseMirrorNodeView } from 'prosemirror-view'\nimport { Node as ProseMirrorNode } from 'prosemirror-model'\nimport { Editor } from './Editor'\nimport { ReactRenderer } from './ReactRenderer'\nimport { ReactNodeViewContext } from './useReactNodeView'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update: ((props: {\n oldNode: ProseMirrorNode,\n oldDecorations: Decoration[],\n newNode: ProseMirrorNode,\n newDecorations: Decoration[],\n updateProps: () => void,\n }) => boolean) | null,\n}\n\nclass ReactNodeView extends NodeView<React.FunctionComponent, Editor, 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 onDragStart = this.onDragStart.bind(this)\n const maybeMoveContentDOM = this.maybeMoveContentDOM.bind(this)\n const Component = this.component\n\n return (\n <ReactNodeViewContext.Provider value={{ onDragStart, maybeMoveContentDOM }}>\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 this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as: this.node.isInline\n ? 'span'\n : 'div',\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\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n this.maybeMoveContentDOM()\n\n return this.contentDOMElement\n }\n\n maybeMoveContentDOM(): void {\n const contentElement = this.dom.querySelector('[data-node-view-content]')\n\n if (\n this.contentDOMElement\n && contentElement\n && !contentElement.contains(this.contentDOMElement)\n ) {\n contentElement.appendChild(this.contentDOMElement)\n }\n }\n\n update(node: ProseMirrorNode, decorations: Decoration[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n this.maybeMoveContentDOM()\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.type !== this.node.type) {\n return false\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(component: any, options?: Partial<ReactNodeViewRendererOptions>): 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 ProseMirrorNodeView\n }\n}\n","import React, { HTMLProps } from 'react'\nimport ReactDOM from 'react-dom'\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 React from 'react'\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 ...props.style,\n whiteSpace: 'normal',\n }}\n />\n )\n})\n","import React, { useEffect } from 'react'\nimport { useReactNodeView } from './useReactNodeView'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = React.forwardRef((props, ref) => {\n const Tag = props.as || 'div'\n const { maybeMoveContentDOM } = useReactNodeView()\n\n useEffect(() => {\n maybeMoveContentDOM?.()\n }, [])\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-content=\"\"\n style={{\n ...props.style,\n whiteSpace: 'pre-wrap',\n }}\n />\n )\n})\n"],"names":["CoreEditor"],"mappings":";;;;;;;MASa,UAAU,GAA8B,KAAK;IACxD,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IAE5C,SAAS,CAAC;QACR,MAAM,EACJ,SAAS,GAAG,YAAY,EACxB,MAAM,EACN,YAAY,GAAG,EAAE,EACjB,UAAU,GAAG,IAAI,GAClB,GAAG,KAAK,CAAA;QAET,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC;YACrC,SAAS;YACT,MAAM;YACN,OAAO,EAAE,OAAO,CAAC,OAAsB;YACvC,YAAY;YACZ,UAAU;SACX,CAAC,CAAC,CAAA;QAEH,OAAO;YACL,MAAM,CAAC,gBAAgB,CAAC,SAAS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