diff --git a/package.json b/package.json index 5011717916f..ffbc16002f3 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "dependencies": { "@tiptap/extension-bubble-menu": "^2.0.0-beta.59", "@tiptap/extension-floating-menu": "^2.0.0-beta.54", - "prosemirror-view": "^1.23.6" + "prosemirror-view": "^1.25.0" }, "repository": { "type": "git", diff --git a/src/ReactNodeViewRenderer.tsx b/src/ReactNodeViewRenderer.tsx index 4d6d89dbaa8..77d9721c242 100644 --- a/src/ReactNodeViewRenderer.tsx +++ b/src/ReactNodeViewRenderer.tsx @@ -14,19 +14,24 @@ import { ReactRenderer } from './ReactRenderer' import { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView' export interface ReactNodeViewRendererOptions extends NodeViewRendererOptions { - update: ((props: { - oldNode: ProseMirrorNode, - oldDecorations: Decoration[], - newNode: ProseMirrorNode, - newDecorations: Decoration[], - updateProps: () => void, - }) => boolean) | null, - as?: string, - className?: string, + update: + | ((props: { + oldNode: ProseMirrorNode; + oldDecorations: Decoration[]; + newNode: ProseMirrorNode; + newDecorations: Decoration[]; + updateProps: () => void; + }) => boolean) + | null; + as?: string; + className?: string; } -class ReactNodeView extends NodeView { - +class ReactNodeView extends NodeView< + React.FunctionComponent, + Editor, + ReactNodeViewRendererOptions +> { renderer!: ReactRenderer contentDOMElement!: HTMLElement | null @@ -55,11 +60,7 @@ class ReactNodeView extends NodeView { - if ( - element - && this.contentDOMElement - && element.firstChild !== this.contentDOMElement - ) { + if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) { element.appendChild(this.contentDOMElement) } } @@ -108,7 +109,7 @@ class ReactNodeView extends NodeView): NodeViewRenderer { +export function ReactNodeViewRenderer( + component: any, + options?: Partial, +): NodeViewRenderer { return (props: NodeViewRendererProps) => { // try to get the parent component // this is important for vue devtools to show the component hierarchy correctly @@ -183,6 +187,6 @@ export function ReactNodeViewRenderer(component: any, options?: Partial