2021-03-30 17:36:51 +08:00
|
|
|
import { Extension } from '@tiptap/core'
|
2021-03-30 18:45:56 +08:00
|
|
|
import { BubbleMenuPlugin, BubbleMenuPluginOptions } from './bubble-menu-plugin'
|
2021-03-30 17:36:51 +08:00
|
|
|
|
2021-03-30 18:45:56 +08:00
|
|
|
export type BubbleMenuOptions = Omit<BubbleMenuPluginOptions, 'editor'>
|
2021-03-30 17:36:51 +08:00
|
|
|
|
|
|
|
export const BubbleMenu = Extension.create<BubbleMenuOptions>({
|
|
|
|
name: 'bubbleMenu',
|
|
|
|
|
|
|
|
defaultOptions: {
|
|
|
|
element: document.createElement('div'),
|
|
|
|
keepInBounds: true,
|
|
|
|
},
|
|
|
|
|
|
|
|
addProseMirrorPlugins() {
|
|
|
|
return [
|
|
|
|
BubbleMenuPlugin({
|
|
|
|
editor: this.editor,
|
|
|
|
element: this.options.element,
|
|
|
|
keepInBounds: this.options.keepInBounds,
|
|
|
|
}),
|
|
|
|
]
|
|
|
|
},
|
|
|
|
})
|