mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-24 03:39:01 +08:00
fix using registerPlugin and unregisterPlugin for vue-3
This commit is contained in:
parent
2b0a0dad0f
commit
d06f5c0c73
@ -25,6 +25,7 @@
|
||||
"@tiptap/core": "^2.0.0-beta.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"prosemirror-state": "^1.3.4",
|
||||
"prosemirror-view": "^1.18.2",
|
||||
"vue": "^3.0.0"
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user