diff --git a/packages/vue-3/package.json b/packages/vue-3/package.json index b9155736..c9d17a1d 100644 --- a/packages/vue-3/package.json +++ b/packages/vue-3/package.json @@ -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" } diff --git a/packages/vue-3/src/Editor.ts b/packages/vue-3/src/Editor.ts index c516d663..5c61c6c8 100644 --- a/packages/vue-3/src/Editor.ts +++ b/packages/vue-3/src/Editor.ts @@ -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(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 + } }