You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
899 B

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',
addOptions() {
return {
element: null,
tippyOptions: {},
pluginKey: 'bubbleMenu',
updateDelay: undefined,
shouldShow: null,
}
},
addProseMirrorPlugins() {
if (!this.options.element) {
return []
}
return [
BubbleMenuPlugin({
pluginKey: this.options.pluginKey,
editor: this.editor,
element: this.options.element,
tippyOptions: this.options.tippyOptions,
updateDelay: this.options.updateDelay,
shouldShow: this.options.shouldShow,
}),
]
},
})