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 { export interface BubbleMenuPluginProps {
editor: Editor, editor: Editor,
element: HTMLElement, element: HTMLElement,
keepInBounds: boolean,
} }
export type BubbleMenuViewProps = BubbleMenuPluginProps & { export type BubbleMenuViewProps = BubbleMenuPluginProps & {

View File

@@ -10,7 +10,6 @@ export const BubbleMenu = Extension.create<BubbleMenuOptions>({
defaultOptions: { defaultOptions: {
element: null, element: null,
keepInBounds: true,
}, },
addProseMirrorPlugins() { addProseMirrorPlugins() {
@@ -22,7 +21,6 @@ export const BubbleMenu = Extension.create<BubbleMenuOptions>({
BubbleMenuPlugin({ BubbleMenuPlugin({
editor: this.editor, editor: this.editor,
element: this.options.element, 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) const element = useRef<HTMLDivElement>(null)
useEffect(() => { useEffect(() => {
const { editor, keepInBounds = true } = props const { editor } = props
editor.registerPlugin(BubbleMenuPlugin({ editor.registerPlugin(BubbleMenuPlugin({
editor, editor,
element: element.current as HTMLElement, element: element.current as HTMLElement,
keepInBounds,
})) }))
return () => { return () => {

View File

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

View File

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