diff --git a/app/components/PostBodyMarkdownEditor.vue b/app/components/PostBodyMarkdownEditor.vue index 0d2049f..500b0c5 100644 --- a/app/components/PostBodyMarkdownEditor.vue +++ b/app/components/PostBodyMarkdownEditor.vue @@ -16,6 +16,7 @@ const emit = defineEmits<{ const toast = useToast() const mountEl = ref(null) const isMobileViewport = ref(false) +const isEditorReady = ref(false) const editorContainerStyle = computed(() => { if (isMobileViewport.value) { return { @@ -89,6 +90,7 @@ onMounted(async () => { vditorCtor.value = ctor if (mountEl.value) { bridge.mount(mountEl.value) + isEditorReady.value = true } }, onError: (error) => { @@ -103,6 +105,7 @@ watch(() => props.modelValue, () => { onBeforeUnmount(() => { unmounted = true + isEditorReady.value = false if (viewportMql && onViewportChange) { viewportMql.removeEventListener('change', onViewportChange) } @@ -114,11 +117,22 @@ onBeforeUnmount(() => {