Skip to content

Commit d38507c

Browse files
committed
修复退出格式刷后,气泡菜单不显示的问题
1 parent a9326fc commit d38507c

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/components/editor/index.vue

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
v-if="editor && !destroyed && !page.preview?.enabled && editor.isEditable"
2121
>
2222
<menus-context-block v-if="options.document?.enableBlockMenu" />
23-
<menus-bubble v-if="options.document?.enableBubbleMenu" />
23+
<menus-bubble
24+
v-if="options.document?.enableBubbleMenu"
25+
v-show="!editor?.view?.painter?.enabled && !editor?.isEmpty"
26+
/>
2427
</template>
2528
</template>
2629

src/components/menus/bubble/index.vue

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<template>
22
<bubble-menu
3-
v-show="!editor?.view?.painter?.enabled && !editor?.isEmpty"
43
class="umo-editor-bubble-menu"
54
:class="{ assistant }"
65
:editor="editor!"
@@ -46,11 +45,21 @@ const tippyOpitons = $ref<Partial<Instance>>({
4645
watch(
4746
() => [assistant.value],
4847
(visible: any[]) => {
49-
tippyInstance?.setProps({
50-
placement: visible.includes(true) ? 'bottom' : 'top',
51-
})
48+
if (tippyInstance) {
49+
tippyInstance?.setProps({
50+
placement: visible.includes(true) ? 'bottom' : 'top',
51+
})
52+
}
5253
},
5354
)
55+
56+
// 销毁 tippy
57+
onUnmounted(() => {
58+
if (tippyInstance) {
59+
tippyInstance.destroy()
60+
tippyInstance = null
61+
}
62+
})
5463
</script>
5564

5665
<style lang="less">

0 commit comments

Comments
 (0)