From 7d43fb2c6ff4d33f0cec073dbb37df99b8e70504 Mon Sep 17 00:00:00 2001 From: Dominik <6538827+bdbch@users.noreply.github.com> Date: Mon, 20 Jun 2022 11:45:37 +0200 Subject: [PATCH] chore: migrate to new versions of prosemirror packages (#2854) * refactor: upgrade prosemirror packages to new typescript versions * refactor: migrate to new typings from prosemirror * style: fix linting issues * style: fix linting issues * style: fix linting issues * fix(ci): fix build process by reimplement filterTransaction * fix(extension-test): fix broken build because of wrong output file names * fix: fix prosemirror-tables not being bundled correctly for ES6 * fix: move to prosemirror-tables-contently until es6 build is working * fix: fix tests for youtube * fix: fix youtube test * fix(demos): fix demos build --- package.json | 2 +- src/ReactNodeViewRenderer.tsx | 42 +++++++++++++++++++---------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 501171791..ffbc16002 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 4d6d89dba..77d9721c2 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