fix using registerPlugin and unregisterPlugin for vue-3
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { EditorState, Plugin, PluginKey } from 'prosemirror-state'
|
||||
import { Editor as CoreEditor, EditorOptions } from '@tiptap/core'
|
||||
import {
|
||||
markRaw,
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
ComponentPublicInstance,
|
||||
reactive,
|
||||
} from 'vue'
|
||||
import { EditorState } from 'prosemirror-state'
|
||||
import { VueRenderer } from './VueRenderer'
|
||||
|
||||
function useDebouncedRef<T>(value: T) {
|
||||
@@ -60,4 +60,20 @@ export class Editor extends CoreEditor {
|
||||
? this.reactiveState.value
|
||||
: this.view.state
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a ProseMirror plugin.
|
||||
*/
|
||||
public registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void {
|
||||
super.registerPlugin(plugin, handlePlugins)
|
||||
this.reactiveState.value = this.view.state
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister a ProseMirror plugin.
|
||||
*/
|
||||
public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {
|
||||
super.unregisterPlugin(nameOrPluginKey)
|
||||
this.reactiveState.value = this.view.state
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user