mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-21 15:28:09 +08:00
30 lines
658 B
TypeScript
30 lines
658 B
TypeScript
import { Extension } from '@tiptap/core'
|
|
import { BubbleMenuPlugin, BubbleMenuPluginProps } from './bubble-menu-plugin'
|
|
|
|
export type BubbleMenuOptions = Omit<BubbleMenuPluginProps, 'editor' | 'element'> & {
|
|
element: HTMLElement | null,
|
|
}
|
|
|
|
export const BubbleMenu = Extension.create<BubbleMenuOptions>({
|
|
name: 'bubbleMenu',
|
|
|
|
defaultOptions: {
|
|
element: null,
|
|
tippyOptions: {},
|
|
},
|
|
|
|
addProseMirrorPlugins() {
|
|
if (!this.options.element) {
|
|
return []
|
|
}
|
|
|
|
return [
|
|
BubbleMenuPlugin({
|
|
editor: this.editor,
|
|
element: this.options.element,
|
|
tippyOptions: this.options.tippyOptions,
|
|
}),
|
|
]
|
|
},
|
|
})
|