feat: remove keepInBounds

This commit is contained in:
Philipp Kühn 2021-04-16 10:46:50 +02:00
parent 9335858392
commit d7282f168b
5 changed files with 2 additions and 18 deletions

View File

@ -6,7 +6,6 @@ import tippy from 'tippy.js'
export interface BubbleMenuPluginProps {
editor: Editor,
element: HTMLElement,
keepInBounds: boolean,
}
export type BubbleMenuViewProps = BubbleMenuPluginProps & {

View File

@ -10,7 +10,6 @@ export const BubbleMenu = Extension.create<BubbleMenuOptions>({
defaultOptions: {
element: null,
keepInBounds: true,
},
addProseMirrorPlugins() {
@ -22,7 +21,6 @@ export const BubbleMenu = Extension.create<BubbleMenuOptions>({
BubbleMenuPlugin({
editor: this.editor,
element: this.options.element,
keepInBounds: this.options.keepInBounds,
}),
]
},

View File

@ -9,12 +9,11 @@ export const BubbleMenu: React.FC<BubbleMenuProps> = props => {
const element = useRef<HTMLDivElement>(null)
useEffect(() => {
const { editor, keepInBounds = true } = props
const { editor } = props
editor.registerPlugin(BubbleMenuPlugin({
editor,
element: element.current as HTMLElement,
keepInBounds,
}))
return () => {

View File

@ -9,11 +9,6 @@ export const BubbleMenu = Vue.extend({
type: Object as PropType<BubbleMenuPluginProps['editor']>,
required: true,
},
keepInBounds: {
type: Boolean as PropType<BubbleMenuPluginProps['keepInBounds']>,
default: true,
},
},
watch: {
@ -28,7 +23,6 @@ export const BubbleMenu = Vue.extend({
editor.registerPlugin(BubbleMenuPlugin({
editor,
element: this.$el as HTMLElement,
keepInBounds: this.keepInBounds,
}))
})
},

View File

@ -20,21 +20,15 @@ export const BubbleMenu = defineComponent({
type: Object as PropType<BubbleMenuPluginProps['editor']>,
required: true,
},
keepInBounds: {
type: Boolean as PropType<BubbleMenuPluginProps['keepInBounds']>,
default: true,
},
},
setup({ editor, keepInBounds }, { slots }) {
setup({ editor }, { slots }) {
const root = ref<HTMLElement | null>(null)
onMounted(() => {
editor.registerPlugin(BubbleMenuPlugin({
editor,
element: root.value as HTMLElement,
keepInBounds,
}))
})