feat: remove keepInBounds
This commit is contained in:
@@ -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 & {
|
||||||
|
|||||||
@@ -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,
|
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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 () => {
|
||||||
|
|||||||
@@ -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,
|
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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,
|
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user