fix some typescript bugs
This commit is contained in:
@@ -1,12 +1,6 @@
|
|||||||
import { Editor as CoreEditor } from '@tiptap/core'
|
import { Editor as CoreEditor } from '@tiptap/core'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
declare module '@tiptap/core' {
|
|
||||||
interface Editor {
|
|
||||||
contentComponent: Vue | null,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Editor extends CoreEditor {
|
export class Editor extends CoreEditor {
|
||||||
public contentComponent: Vue | null = null
|
public contentComponent: Vue | null = null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class VueNodeView implements NodeView {
|
|||||||
|
|
||||||
constructor(component: Vue | VueConstructor, props: NodeViewRendererProps, options?: Partial<VueNodeViewRendererOptions>) {
|
constructor(component: Vue | VueConstructor, props: NodeViewRendererProps, options?: Partial<VueNodeViewRendererOptions>) {
|
||||||
this.options = { ...this.options, ...options }
|
this.options = { ...this.options, ...options }
|
||||||
this.editor = props.editor
|
this.editor = props.editor as Editor
|
||||||
this.extension = props.extension
|
this.extension = props.extension
|
||||||
this.node = props.node
|
this.node = props.node
|
||||||
this.getPos = props.getPos
|
this.getPos = props.getPos
|
||||||
@@ -257,7 +257,7 @@ export function VueNodeViewRenderer(component: Vue | VueConstructor, options?: P
|
|||||||
// try to get the parent component
|
// try to get the parent component
|
||||||
// this is important for vue devtools to show the component hierarchy correctly
|
// this is important for vue devtools to show the component hierarchy correctly
|
||||||
// maybe it’s `undefined` because <editor-content> isn’t rendered yet
|
// maybe it’s `undefined` because <editor-content> isn’t rendered yet
|
||||||
if (!props.editor.contentComponent) {
|
if (!(props.editor as Editor).contentComponent) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
export * from '@tiptap/core'
|
export * from '@tiptap/core'
|
||||||
export { Editor } from './Editor'
|
export { Editor } from './Editor'
|
||||||
|
export * from './EditorContent'
|
||||||
export * from './VueRenderer'
|
export * from './VueRenderer'
|
||||||
export * from './VueNodeViewRenderer'
|
export * from './VueNodeViewRenderer'
|
||||||
export * from './EditorContent'
|
|
||||||
export * from './NodeViewWrapper'
|
export * from './NodeViewWrapper'
|
||||||
export * from './NodeViewContent'
|
export * from './NodeViewContent'
|
||||||
|
|||||||
@@ -36,13 +36,6 @@ export type ContentComponent = ComponentInternalInstance & {
|
|||||||
ctx: ComponentPublicInstance,
|
ctx: ComponentPublicInstance,
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@tiptap/core' {
|
|
||||||
interface Editor {
|
|
||||||
contentComponent: ContentComponent | null,
|
|
||||||
vueRenderers: Map<string, VueRenderer>,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Editor extends CoreEditor {
|
export class Editor extends CoreEditor {
|
||||||
private reactiveState: Ref<EditorState>
|
private reactiveState: Ref<EditorState>
|
||||||
|
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ export function VueNodeViewRenderer(component: Component, options?: Partial<VueN
|
|||||||
// try to get the parent component
|
// try to get the parent component
|
||||||
// this is important for vue devtools to show the component hierarchy correctly
|
// this is important for vue devtools to show the component hierarchy correctly
|
||||||
// maybe it’s `undefined` because <editor-content> isn’t rendered yet
|
// maybe it’s `undefined` because <editor-content> isn’t rendered yet
|
||||||
if (!props.editor.contentComponent) {
|
if (!(props.editor as Editor).contentComponent) {
|
||||||
return {}
|
return {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user