1
0

fix(editor): show editor if there is no content initially

This commit is contained in:
kolaente
2023-12-11 21:55:27 +01:00
parent 3cb1e7dede
commit af13d68c48
3 changed files with 31 additions and 63 deletions

View File

@ -31,14 +31,13 @@
</template>
<script setup lang="ts">
import {ref, computed, watch, nextTick} from 'vue'
import {ref, computed, watch} from 'vue'
import CustomTransition from '@/components/misc/CustomTransition.vue'
import Editor from '@/components/input/AsyncEditor'
import type {ITask} from '@/modelTypes/ITask'
import {useTaskStore} from '@/stores/tasks'
import {isEditorContentEmpty} from '@/helpers/editorContentEmpty'
type AttachmentUploadFunction = (file: File, onSuccess: (attachmentUrl: string) => void) => Promise<string>
@ -63,15 +62,10 @@ const saving = ref(false)
const taskStore = useTaskStore()
const loading = computed(() => taskStore.isLoading)
const editorMode = ref('preview')
watch(
() => modelValue.description,
value => {
description.value = value
nextTick(() => {
editorMode.value = isEditorContentEmpty(value) ? 'edit' : 'preview'
})
},
{immediate: true},
)