add basic floating menu

This commit is contained in:
Philipp Kühn
2021-04-01 15:19:31 +02:00
parent 0e11fa6cff
commit 007e6f855b
10 changed files with 370 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { Extension } from '@tiptap/core'
import { FloatingMenuPlugin, FloatingMenuPluginProps } from './floating-menu-plugin'
export type FloatingMenuOptions = Omit<FloatingMenuPluginProps, 'editor' | 'element'> & {
element: HTMLElement | null,
}
export const FloatingMenu = Extension.create<FloatingMenuOptions>({
name: 'bubbleMenu',
defaultOptions: {
element: null,
},
addProseMirrorPlugins() {
if (!this.options.element) {
return []
}
return [
FloatingMenuPlugin({
editor: this.editor,
element: this.options.element,
}),
]
},
})