refactor: don’t use destructuring for props
This commit is contained in:
@@ -27,10 +27,12 @@ export const BubbleMenu = defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
setup({ editor, tippyOptions }, { slots }) {
|
setup(props, { slots }) {
|
||||||
const root = ref<HTMLElement | null>(null)
|
const root = ref<HTMLElement | null>(null)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
const { editor, tippyOptions } = props
|
||||||
|
|
||||||
editor.registerPlugin(BubbleMenuPlugin({
|
editor.registerPlugin(BubbleMenuPlugin({
|
||||||
editor,
|
editor,
|
||||||
element: root.value as HTMLElement,
|
element: root.value as HTMLElement,
|
||||||
@@ -39,6 +41,8 @@ export const BubbleMenu = defineComponent({
|
|||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
const { editor } = props
|
||||||
|
|
||||||
editor.unregisterPlugin(BubbleMenuPluginKey)
|
editor.unregisterPlugin(BubbleMenuPluginKey)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -27,10 +27,12 @@ export const FloatingMenu = defineComponent({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
setup({ editor, tippyOptions }, { slots }) {
|
setup(props, { slots }) {
|
||||||
const root = ref<HTMLElement | null>(null)
|
const root = ref<HTMLElement | null>(null)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
const { editor, tippyOptions } = props
|
||||||
|
|
||||||
editor.registerPlugin(FloatingMenuPlugin({
|
editor.registerPlugin(FloatingMenuPlugin({
|
||||||
editor,
|
editor,
|
||||||
element: root.value as HTMLElement,
|
element: root.value as HTMLElement,
|
||||||
@@ -39,6 +41,8 @@ export const FloatingMenu = defineComponent({
|
|||||||
})
|
})
|
||||||
|
|
||||||
onBeforeUnmount(() => {
|
onBeforeUnmount(() => {
|
||||||
|
const { editor } = props
|
||||||
|
|
||||||
editor.unregisterPlugin(FloatingMenuPluginKey)
|
editor.unregisterPlugin(FloatingMenuPluginKey)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user