improve some types, fix #213
This commit is contained in:
@@ -40,11 +40,11 @@ export class VueRenderer {
|
||||
}
|
||||
}
|
||||
|
||||
get ref() {
|
||||
get ref(): any {
|
||||
return this.editor.contentComponent?.ctx.$refs[this.id]
|
||||
}
|
||||
|
||||
updateProps(props: AnyObject = {}) {
|
||||
updateProps(props: AnyObject = {}): void {
|
||||
Object
|
||||
.entries(props)
|
||||
.forEach(([key, value]) => {
|
||||
@@ -52,7 +52,7 @@ export class VueRenderer {
|
||||
})
|
||||
}
|
||||
|
||||
destroy() {
|
||||
destroy(): void {
|
||||
this.editor.vueRenderers.delete(this.id)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ import { EditorOptions } from '@tiptap/core'
|
||||
import { Editor } from './Editor'
|
||||
|
||||
export const useEditor = (options: Partial<EditorOptions> = {}) => {
|
||||
const editor = ref()
|
||||
const editor = ref<Editor>()
|
||||
|
||||
onMounted(() => {
|
||||
editor.value = new Editor(options)
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
editor.value.destroy()
|
||||
editor.value?.destroy()
|
||||
})
|
||||
|
||||
return editor
|
||||
|
||||
Reference in New Issue
Block a user