mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-04 17:07:50 +08:00
30 lines
676 B
TypeScript
30 lines
676 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: 'floatingMenu',
|
|
|
|
defaultOptions: {
|
|
element: null,
|
|
tippyOptions: {},
|
|
},
|
|
|
|
addProseMirrorPlugins() {
|
|
if (!this.options.element) {
|
|
return []
|
|
}
|
|
|
|
return [
|
|
FloatingMenuPlugin({
|
|
editor: this.editor,
|
|
element: this.options.element,
|
|
tippyOptions: this.options.tippyOptions,
|
|
}),
|
|
]
|
|
},
|
|
})
|