mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-08 04:18:06 +08:00
28 lines
603 B
TypeScript
28 lines
603 B
TypeScript
|
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,
|
||
|
}),
|
||
|
]
|
||
|
},
|
||
|
})
|