diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 534735a76..b9ff3aafd 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -97,7 +97,7 @@ export type NodeViewRendererProps = { extension: Node, } -export type NodeViewRenderer = (props: NodeViewRendererProps) => NodeView +export type NodeViewRenderer = (props: NodeViewRendererProps) => (NodeView | {}) export type UnfilteredCommands = { [Item in keyof AllExtensions]: AllExtensions[Item] extends Extension diff --git a/packages/vue/src/VueRenderer.ts b/packages/vue/src/VueRenderer.ts index a5fd47880..4215b9c2e 100644 --- a/packages/vue/src/VueRenderer.ts +++ b/packages/vue/src/VueRenderer.ts @@ -1,4 +1,9 @@ -import { Editor, Node, NodeViewRendererProps } from '@tiptap/core' +import { + Editor, + Node, + NodeViewRenderer, + NodeViewRendererProps, +} from '@tiptap/core' import { Decoration, NodeView } from 'prosemirror-view' import { NodeSelection } from 'prosemirror-state' import { Node as ProseMirrorNode } from 'prosemirror-model' @@ -309,7 +314,7 @@ class VueNodeView implements NodeView { } -export default function VueRenderer(component: Vue | VueConstructor, options?: Partial) { +export default function VueRenderer(component: Vue | VueConstructor, options?: Partial): NodeViewRenderer { return (props: NodeViewRendererProps) => { // try to get the parent component // this is important for vue devtools to show the component hierarchy correctly @@ -319,7 +324,7 @@ export default function VueRenderer(component: Vue | VueConstructor, options?: P : undefined if (!parent) { - return undefined + return {} } return new VueNodeView(component, props, options) as NodeView