fix: Made editor prop reactive

This commit is contained in:
Muhammed Mustafa
2023-11-23 11:20:40 +00:00
parent 4aca960b40
commit aba4b2a85d
2 changed files with 30 additions and 24 deletions

View File

@@ -2,17 +2,19 @@
import type { Editor } from '@tiptap/vue-3'
import { BubbleMenu } from '@tiptap/vue-3'
const { editor } = defineProps<Props>()
const props = defineProps<Props>()
interface Props {
editor: Editor
}
const editor = computed(() => props.editor)
// Debounce show menu to prevent flickering
const showMenu = computed(() => {
if (!editor) return false
return !editor.state.selection.empty
return !editor.value.state.selection.empty
})
const showMenuDebounced = ref(false)