mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-22 16:17:50 +08:00
27 lines
575 B
TypeScript
27 lines
575 B
TypeScript
|
import { Extension } from '@tiptap/core'
|
||
|
import { BubbleMenuPlugin } from './bubble-menu-plugin'
|
||
|
|
||
|
export interface BubbleMenuOptions {
|
||
|
element: HTMLElement,
|
||
|
keepInBounds: boolean,
|
||
|
}
|
||
|
|
||
|
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,
|
||
|
}),
|
||
|
]
|
||
|
},
|
||
|
})
|