@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/README.md
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
## Introduction
|
|
8
8
|
tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## Official Documentation
|
|
11
11
|
Documentation can be found on the [tiptap website](https://tiptap.dev).
|
|
12
12
|
|
|
13
13
|
## License
|
|
14
|
-
tiptap is open
|
|
14
|
+
tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
4
|
+
export declare type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey'>, 'element'> & {
|
|
5
|
+
className?: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare const BubbleMenu: (props: BubbleMenuProps) => JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Editor as CoreEditor } from '@tiptap/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { EditorContentProps, EditorContentState } from './EditorContent';
|
|
3
4
|
export declare class Editor extends CoreEditor {
|
|
4
|
-
contentComponent: React.Component | null;
|
|
5
|
+
contentComponent: React.Component<EditorContentProps, EditorContentState> | null;
|
|
5
6
|
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { HTMLProps } from 'react';
|
|
2
2
|
import { Editor } from './Editor';
|
|
3
|
-
|
|
3
|
+
import { ReactRenderer } from './ReactRenderer';
|
|
4
|
+
export interface EditorContentProps extends HTMLProps<HTMLDivElement> {
|
|
4
5
|
editor: Editor | null;
|
|
5
|
-
}
|
|
6
|
-
export
|
|
6
|
+
}
|
|
7
|
+
export interface EditorContentState {
|
|
8
|
+
renderers: Map<string, ReactRenderer>;
|
|
9
|
+
}
|
|
10
|
+
export declare class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {
|
|
7
11
|
editorContentRef: React.RefObject<any>;
|
|
8
12
|
constructor(props: EditorContentProps);
|
|
13
|
+
componentDidMount(): void;
|
|
9
14
|
componentDidUpdate(): void;
|
|
15
|
+
init(): void;
|
|
16
|
+
componentWillUnmount(): void;
|
|
10
17
|
render(): JSX.Element;
|
|
11
18
|
}
|
|
12
19
|
export declare const EditorContent: React.MemoExoticComponent<typeof PureEditorContent>;
|
|
13
|
-
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
|
|
4
|
+
export declare type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey'>, 'element'> & {
|
|
5
|
+
className?: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare const FloatingMenu: (props: FloatingMenuProps) => JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NodeViewRenderer, NodeViewRendererOptions } from '@tiptap/core';
|
|
2
|
+
import { Node as ProseMirrorNode } from 'prosemirror-model';
|
|
3
|
+
import { Decoration } from 'prosemirror-view';
|
|
4
|
+
export interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {
|
|
5
|
+
update: ((props: {
|
|
6
|
+
oldNode: ProseMirrorNode;
|
|
7
|
+
oldDecorations: Decoration[];
|
|
8
|
+
newNode: ProseMirrorNode;
|
|
9
|
+
newDecorations: Decoration[];
|
|
10
|
+
updateProps: () => void;
|
|
11
|
+
}) => boolean) | null;
|
|
12
|
+
as?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function ReactNodeViewRenderer(component: any, options?: Partial<ReactNodeViewRendererOptions>): NodeViewRenderer;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Editor as ExtendedEditor } from './Editor';
|
|
4
|
+
export interface ReactRendererOptions {
|
|
5
|
+
editor: Editor;
|
|
6
|
+
props?: Record<string, any>;
|
|
7
|
+
as?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare type ComponentType<R, P> = React.ComponentClass<P> | React.FunctionComponent<P> | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;
|
|
11
|
+
export declare class ReactRenderer<R = unknown, P = unknown> {
|
|
12
|
+
id: string;
|
|
13
|
+
editor: ExtendedEditor;
|
|
14
|
+
component: any;
|
|
15
|
+
element: Element;
|
|
16
|
+
props: Record<string, any>;
|
|
17
|
+
reactElement: React.ReactNode;
|
|
18
|
+
ref: R | null;
|
|
19
|
+
constructor(component: ComponentType<R, P>, { editor, props, as, className, }: ReactRendererOptions);
|
|
20
|
+
render(): void;
|
|
21
|
+
updateProps(props?: Record<string, any>): void;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
export * from '
|
|
1
|
+
export * from './BubbleMenu';
|
|
2
2
|
export { Editor } from './Editor';
|
|
3
|
-
export * from './useEditor';
|
|
4
3
|
export * from './EditorContent';
|
|
4
|
+
export * from './FloatingMenu';
|
|
5
|
+
export * from './NodeViewContent';
|
|
6
|
+
export * from './NodeViewWrapper';
|
|
7
|
+
export * from './ReactNodeViewRenderer';
|
|
8
|
+
export * from './ReactRenderer';
|
|
9
|
+
export * from './useEditor';
|
|
10
|
+
export * from '@tiptap/core';
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { EditorOptions } from '@tiptap/core';
|
|
2
|
+
import { DependencyList } from 'react';
|
|
2
3
|
import { Editor } from './Editor';
|
|
3
|
-
export declare const useEditor: (options?: Partial<EditorOptions
|
|
4
|
+
export declare const useEditor: (options?: Partial<EditorOptions>, deps?: DependencyList) => Editor | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface ReactNodeViewContextProps {
|
|
3
|
+
onDragStart: (event: DragEvent) => void;
|
|
4
|
+
nodeViewContentRef: (element: HTMLElement | null) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const ReactNodeViewContext: import("react").Context<Partial<ReactNodeViewContextProps>>;
|
|
7
|
+
export declare const useReactNodeView: () => Partial<ReactNodeViewContextProps>;
|
package/dist/tiptap-react.cjs.js
CHANGED
|
@@ -2,12 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var extensionBubbleMenu = require('@tiptap/extension-bubble-menu');
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var core = require('@tiptap/core');
|
|
8
|
+
var ReactDOM = require('react-dom');
|
|
9
|
+
var extensionFloatingMenu = require('@tiptap/extension-floating-menu');
|
|
7
10
|
|
|
8
11
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
12
|
|
|
10
13
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
14
|
+
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
15
|
+
|
|
16
|
+
const BubbleMenu = (props) => {
|
|
17
|
+
const [element, setElement] = React.useState(null);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (!element) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (props.editor.isDestroyed) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const { pluginKey = 'bubbleMenu', editor, tippyOptions = {}, shouldShow = null, } = props;
|
|
26
|
+
const plugin = extensionBubbleMenu.BubbleMenuPlugin({
|
|
27
|
+
pluginKey,
|
|
28
|
+
editor,
|
|
29
|
+
element,
|
|
30
|
+
tippyOptions,
|
|
31
|
+
shouldShow,
|
|
32
|
+
});
|
|
33
|
+
editor.registerPlugin(plugin);
|
|
34
|
+
return () => editor.unregisterPlugin(pluginKey);
|
|
35
|
+
}, [
|
|
36
|
+
props.editor,
|
|
37
|
+
element,
|
|
38
|
+
]);
|
|
39
|
+
return (React__default["default"].createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
40
|
+
};
|
|
11
41
|
|
|
12
42
|
class Editor extends core.Editor {
|
|
13
43
|
constructor() {
|
|
@@ -16,63 +46,347 @@ class Editor extends core.Editor {
|
|
|
16
46
|
}
|
|
17
47
|
}
|
|
18
48
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const forceUpdate = useForceUpdate();
|
|
26
|
-
React.useEffect(() => {
|
|
27
|
-
const instance = new Editor(options);
|
|
28
|
-
setEditor(instance);
|
|
29
|
-
instance.on('transaction', forceUpdate);
|
|
30
|
-
return () => {
|
|
31
|
-
instance.destroy();
|
|
32
|
-
};
|
|
33
|
-
}, []);
|
|
34
|
-
return editor;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
class PureEditorContent extends React__default['default'].Component {
|
|
49
|
+
const Portals = ({ renderers }) => {
|
|
50
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, Array.from(renderers).map(([key, renderer]) => {
|
|
51
|
+
return ReactDOM__default["default"].createPortal(renderer.reactElement, renderer.element, key);
|
|
52
|
+
})));
|
|
53
|
+
};
|
|
54
|
+
class PureEditorContent extends React__default["default"].Component {
|
|
38
55
|
constructor(props) {
|
|
39
56
|
super(props);
|
|
40
|
-
this.editorContentRef = React__default[
|
|
57
|
+
this.editorContentRef = React__default["default"].createRef();
|
|
41
58
|
this.state = {
|
|
42
|
-
|
|
59
|
+
renderers: new Map(),
|
|
43
60
|
};
|
|
44
61
|
}
|
|
62
|
+
componentDidMount() {
|
|
63
|
+
this.init();
|
|
64
|
+
}
|
|
45
65
|
componentDidUpdate() {
|
|
66
|
+
this.init();
|
|
67
|
+
}
|
|
68
|
+
init() {
|
|
46
69
|
const { editor } = this.props;
|
|
47
70
|
if (editor && editor.options.element) {
|
|
71
|
+
if (editor.contentComponent) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
48
74
|
const element = this.editorContentRef.current;
|
|
49
|
-
element.
|
|
75
|
+
element.append(...editor.options.element.childNodes);
|
|
50
76
|
editor.setOptions({
|
|
51
77
|
element,
|
|
52
78
|
});
|
|
53
79
|
editor.contentComponent = this;
|
|
54
|
-
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
editor.createNodeViews();
|
|
57
|
-
}, 0);
|
|
80
|
+
editor.createNodeViews();
|
|
58
81
|
}
|
|
59
82
|
}
|
|
83
|
+
componentWillUnmount() {
|
|
84
|
+
const { editor } = this.props;
|
|
85
|
+
if (!editor) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!editor.isDestroyed) {
|
|
89
|
+
editor.view.setProps({
|
|
90
|
+
nodeViews: {},
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
editor.contentComponent = null;
|
|
94
|
+
if (!editor.options.element.firstChild) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const newElement = document.createElement('div');
|
|
98
|
+
newElement.append(...editor.options.element.childNodes);
|
|
99
|
+
editor.setOptions({
|
|
100
|
+
element: newElement,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
60
103
|
render() {
|
|
61
|
-
|
|
104
|
+
const { editor, ...rest } = this.props;
|
|
105
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
106
|
+
React__default["default"].createElement("div", { ref: this.editorContentRef, ...rest }),
|
|
107
|
+
React__default["default"].createElement(Portals, { renderers: this.state.renderers })));
|
|
62
108
|
}
|
|
63
109
|
}
|
|
64
|
-
const EditorContent = React__default[
|
|
110
|
+
const EditorContent = React__default["default"].memo(PureEditorContent);
|
|
111
|
+
|
|
112
|
+
const FloatingMenu = (props) => {
|
|
113
|
+
const [element, setElement] = React.useState(null);
|
|
114
|
+
React.useEffect(() => {
|
|
115
|
+
if (!element) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (props.editor.isDestroyed) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const { pluginKey = 'floatingMenu', editor, tippyOptions = {}, shouldShow = null, } = props;
|
|
122
|
+
const plugin = extensionFloatingMenu.FloatingMenuPlugin({
|
|
123
|
+
pluginKey,
|
|
124
|
+
editor,
|
|
125
|
+
element,
|
|
126
|
+
tippyOptions,
|
|
127
|
+
shouldShow,
|
|
128
|
+
});
|
|
129
|
+
editor.registerPlugin(plugin);
|
|
130
|
+
return () => editor.unregisterPlugin(pluginKey);
|
|
131
|
+
}, [
|
|
132
|
+
props.editor,
|
|
133
|
+
element,
|
|
134
|
+
]);
|
|
135
|
+
return (React__default["default"].createElement("div", { ref: setElement, className: props.className, style: { visibility: 'hidden' } }, props.children));
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const ReactNodeViewContext = React.createContext({
|
|
139
|
+
onDragStart: undefined,
|
|
140
|
+
});
|
|
141
|
+
const useReactNodeView = () => React.useContext(ReactNodeViewContext);
|
|
142
|
+
|
|
143
|
+
const NodeViewContent = props => {
|
|
144
|
+
const Tag = props.as || 'div';
|
|
145
|
+
const { nodeViewContentRef } = useReactNodeView();
|
|
146
|
+
return (React__default["default"].createElement(Tag, { ...props, ref: nodeViewContentRef, "data-node-view-content": "", style: {
|
|
147
|
+
whiteSpace: 'pre-wrap',
|
|
148
|
+
...props.style,
|
|
149
|
+
} }));
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const NodeViewWrapper = React__default["default"].forwardRef((props, ref) => {
|
|
153
|
+
const { onDragStart } = useReactNodeView();
|
|
154
|
+
const Tag = props.as || 'div';
|
|
155
|
+
return (React__default["default"].createElement(Tag, { ...props, ref: ref, "data-node-view-wrapper": "", onDragStart: onDragStart, style: {
|
|
156
|
+
whiteSpace: 'normal',
|
|
157
|
+
...props.style,
|
|
158
|
+
} }));
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
function isClassComponent(Component) {
|
|
162
|
+
return !!(typeof Component === 'function'
|
|
163
|
+
&& Component.prototype
|
|
164
|
+
&& Component.prototype.isReactComponent);
|
|
165
|
+
}
|
|
166
|
+
function isForwardRefComponent(Component) {
|
|
167
|
+
var _a;
|
|
168
|
+
return !!(typeof Component === 'object'
|
|
169
|
+
&& ((_a = Component.$$typeof) === null || _a === void 0 ? void 0 : _a.toString()) === 'Symbol(react.forward_ref)');
|
|
170
|
+
}
|
|
171
|
+
class ReactRenderer {
|
|
172
|
+
constructor(component, { editor, props = {}, as = 'div', className = '', }) {
|
|
173
|
+
this.ref = null;
|
|
174
|
+
this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString();
|
|
175
|
+
this.component = component;
|
|
176
|
+
this.editor = editor;
|
|
177
|
+
this.props = props;
|
|
178
|
+
this.element = document.createElement(as);
|
|
179
|
+
this.element.classList.add('react-renderer');
|
|
180
|
+
if (className) {
|
|
181
|
+
this.element.classList.add(...className.split(' '));
|
|
182
|
+
}
|
|
183
|
+
this.render();
|
|
184
|
+
}
|
|
185
|
+
render() {
|
|
186
|
+
const Component = this.component;
|
|
187
|
+
const props = this.props;
|
|
188
|
+
if (isClassComponent(Component) || isForwardRefComponent(Component)) {
|
|
189
|
+
props.ref = (ref) => {
|
|
190
|
+
this.ref = ref;
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
this.reactElement = React__default["default"].createElement(Component, { ...props });
|
|
194
|
+
queueMicrotask(() => {
|
|
195
|
+
ReactDOM.flushSync(() => {
|
|
196
|
+
var _a;
|
|
197
|
+
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
|
|
198
|
+
this.editor.contentComponent.setState({
|
|
199
|
+
renderers: this.editor.contentComponent.state.renderers.set(this.id, this),
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
updateProps(props = {}) {
|
|
206
|
+
this.props = {
|
|
207
|
+
...this.props,
|
|
208
|
+
...props,
|
|
209
|
+
};
|
|
210
|
+
this.render();
|
|
211
|
+
}
|
|
212
|
+
destroy() {
|
|
213
|
+
queueMicrotask(() => {
|
|
214
|
+
ReactDOM.flushSync(() => {
|
|
215
|
+
var _a;
|
|
216
|
+
if ((_a = this.editor) === null || _a === void 0 ? void 0 : _a.contentComponent) {
|
|
217
|
+
const { renderers } = this.editor.contentComponent.state;
|
|
218
|
+
renderers.delete(this.id);
|
|
219
|
+
this.editor.contentComponent.setState({
|
|
220
|
+
renderers,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
class ReactNodeView extends core.NodeView {
|
|
229
|
+
mount() {
|
|
230
|
+
const props = {
|
|
231
|
+
editor: this.editor,
|
|
232
|
+
node: this.node,
|
|
233
|
+
decorations: this.decorations,
|
|
234
|
+
selected: false,
|
|
235
|
+
extension: this.extension,
|
|
236
|
+
getPos: () => this.getPos(),
|
|
237
|
+
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
|
238
|
+
deleteNode: () => this.deleteNode(),
|
|
239
|
+
};
|
|
240
|
+
if (!this.component.displayName) {
|
|
241
|
+
const capitalizeFirstChar = (string) => {
|
|
242
|
+
return string.charAt(0).toUpperCase() + string.substring(1);
|
|
243
|
+
};
|
|
244
|
+
this.component.displayName = capitalizeFirstChar(this.extension.name);
|
|
245
|
+
}
|
|
246
|
+
const ReactNodeViewProvider = componentProps => {
|
|
247
|
+
const Component = this.component;
|
|
248
|
+
const onDragStart = this.onDragStart.bind(this);
|
|
249
|
+
const nodeViewContentRef = element => {
|
|
250
|
+
if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {
|
|
251
|
+
element.appendChild(this.contentDOMElement);
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
return (React__default["default"].createElement(ReactNodeViewContext.Provider, { value: { onDragStart, nodeViewContentRef } },
|
|
255
|
+
React__default["default"].createElement(Component, { ...componentProps })));
|
|
256
|
+
};
|
|
257
|
+
ReactNodeViewProvider.displayName = 'ReactNodeView';
|
|
258
|
+
this.contentDOMElement = this.node.isLeaf
|
|
259
|
+
? null
|
|
260
|
+
: document.createElement(this.node.isInline ? 'span' : 'div');
|
|
261
|
+
if (this.contentDOMElement) {
|
|
262
|
+
// For some reason the whiteSpace prop is not inherited properly in Chrome and Safari
|
|
263
|
+
// With this fix it seems to work fine
|
|
264
|
+
// See: https://github.com/ueberdosis/tiptap/issues/1197
|
|
265
|
+
this.contentDOMElement.style.whiteSpace = 'inherit';
|
|
266
|
+
}
|
|
267
|
+
let as = this.node.isInline ? 'span' : 'div';
|
|
268
|
+
if (this.options.as) {
|
|
269
|
+
as = this.options.as;
|
|
270
|
+
}
|
|
271
|
+
const { className = '' } = this.options;
|
|
272
|
+
this.renderer = new ReactRenderer(ReactNodeViewProvider, {
|
|
273
|
+
editor: this.editor,
|
|
274
|
+
props,
|
|
275
|
+
as,
|
|
276
|
+
className: `node-${this.node.type.name} ${className}`.trim(),
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
get dom() {
|
|
280
|
+
var _a;
|
|
281
|
+
if (this.renderer.element.firstElementChild
|
|
282
|
+
&& !((_a = this.renderer.element.firstElementChild) === null || _a === void 0 ? void 0 : _a.hasAttribute('data-node-view-wrapper'))) {
|
|
283
|
+
throw Error('Please use the NodeViewWrapper component for your node view.');
|
|
284
|
+
}
|
|
285
|
+
return this.renderer.element;
|
|
286
|
+
}
|
|
287
|
+
get contentDOM() {
|
|
288
|
+
if (this.node.isLeaf) {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
return this.contentDOMElement;
|
|
292
|
+
}
|
|
293
|
+
update(node, decorations) {
|
|
294
|
+
const updateProps = (props) => {
|
|
295
|
+
this.renderer.updateProps(props);
|
|
296
|
+
};
|
|
297
|
+
if (node.type !== this.node.type) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
if (typeof this.options.update === 'function') {
|
|
301
|
+
const oldNode = this.node;
|
|
302
|
+
const oldDecorations = this.decorations;
|
|
303
|
+
this.node = node;
|
|
304
|
+
this.decorations = decorations;
|
|
305
|
+
return this.options.update({
|
|
306
|
+
oldNode,
|
|
307
|
+
oldDecorations,
|
|
308
|
+
newNode: node,
|
|
309
|
+
newDecorations: decorations,
|
|
310
|
+
updateProps: () => updateProps({ node, decorations }),
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
if (node === this.node && this.decorations === decorations) {
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
this.node = node;
|
|
317
|
+
this.decorations = decorations;
|
|
318
|
+
updateProps({ node, decorations });
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
selectNode() {
|
|
322
|
+
this.renderer.updateProps({
|
|
323
|
+
selected: true,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
deselectNode() {
|
|
327
|
+
this.renderer.updateProps({
|
|
328
|
+
selected: false,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
destroy() {
|
|
332
|
+
this.renderer.destroy();
|
|
333
|
+
this.contentDOMElement = null;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
function ReactNodeViewRenderer(component, options) {
|
|
337
|
+
return (props) => {
|
|
338
|
+
// try to get the parent component
|
|
339
|
+
// this is important for vue devtools to show the component hierarchy correctly
|
|
340
|
+
// maybe it’s `undefined` because <editor-content> isn’t rendered yet
|
|
341
|
+
if (!props.editor.contentComponent) {
|
|
342
|
+
return {};
|
|
343
|
+
}
|
|
344
|
+
return new ReactNodeView(component, props, options);
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function useForceUpdate() {
|
|
349
|
+
const [, setValue] = React.useState(0);
|
|
350
|
+
return () => setValue(value => value + 1);
|
|
351
|
+
}
|
|
352
|
+
const useEditor = (options = {}, deps = []) => {
|
|
353
|
+
const [editor, setEditor] = React.useState(null);
|
|
354
|
+
const forceUpdate = useForceUpdate();
|
|
355
|
+
React.useEffect(() => {
|
|
356
|
+
let isMounted = true;
|
|
357
|
+
const instance = new Editor(options);
|
|
358
|
+
setEditor(instance);
|
|
359
|
+
instance.on('transaction', () => {
|
|
360
|
+
requestAnimationFrame(() => {
|
|
361
|
+
requestAnimationFrame(() => {
|
|
362
|
+
if (isMounted) {
|
|
363
|
+
forceUpdate();
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
return () => {
|
|
369
|
+
instance.destroy();
|
|
370
|
+
isMounted = false;
|
|
371
|
+
};
|
|
372
|
+
}, deps);
|
|
373
|
+
return editor;
|
|
374
|
+
};
|
|
65
375
|
|
|
376
|
+
exports.BubbleMenu = BubbleMenu;
|
|
66
377
|
exports.Editor = Editor;
|
|
67
378
|
exports.EditorContent = EditorContent;
|
|
379
|
+
exports.FloatingMenu = FloatingMenu;
|
|
380
|
+
exports.NodeViewContent = NodeViewContent;
|
|
381
|
+
exports.NodeViewWrapper = NodeViewWrapper;
|
|
68
382
|
exports.PureEditorContent = PureEditorContent;
|
|
383
|
+
exports.ReactNodeViewRenderer = ReactNodeViewRenderer;
|
|
384
|
+
exports.ReactRenderer = ReactRenderer;
|
|
69
385
|
exports.useEditor = useEditor;
|
|
70
386
|
Object.keys(core).forEach(function (k) {
|
|
71
387
|
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
72
388
|
enumerable: true,
|
|
73
|
-
get: function () {
|
|
74
|
-
return core[k];
|
|
75
|
-
}
|
|
389
|
+
get: function () { return core[k]; }
|
|
76
390
|
});
|
|
77
391
|
});
|
|
78
392
|
//# sourceMappingURL=tiptap-react.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-react.cjs.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","useState","useEffect","React"],"mappings":";;;;;;;;;;;MAGa,MAAO,SAAQA,WAAU;IAAt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tD,MAAM,CAAC,UAAU,CAAC;gBAChB,OAAO;aACR,CAAC,CAAA;YAEF,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAA;;YAG9B,UAAU,CAAC;gBACT,MAAM,CAAC,eAAe,EAAE,CAAA;aACzB,EAAE,CAAC,CAAC,CAAA;SACN;KACF;IAED,MAAM;QACJ,QACEA,iDAAK,GAAG,EAAE,IAAI,CAAC,gBAAgB,GAAI,EACpC;KACF;CACF;MAEY,aAAa,GAAGA,yBAAK,CAAC,IAAI,CAAC,iBAAiB;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"tiptap-react.cjs.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":["useState","useEffect","BubbleMenuPlugin","React","CoreEditor","ReactDOM","FloatingMenuPlugin","createContext","useContext","flushSync","NodeView"],"mappings":";;;;;;;;;;;;;;;AAYa,MAAA,UAAU,GAAG,CAAC,KAAsB,KAAI;IACnD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAGA,cAAQ,CAAwB,IAAI,CAAC,CAAA;IAEnEC,eAAS,CAAC,MAAK;QACb,IAAI,CAAC,OAAO,EAAE;YACZ,OAAM;AACP,SAAA;AAED,QAAA,IAAI,KAAK,CAAC,MAAM,CAAC,WAAW,EAAE;YAC5B,OAAM;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