refactor: handle missing message content
This commit is contained in:
@@ -5,11 +5,13 @@ import { extractTextFromMarkdown } from 'dashboard/helper/editorHelper';
|
||||
const { content } = defineProps({
|
||||
content: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
const cleanedContent = computed(() => extractTextFromMarkdown(content));
|
||||
|
||||
const defaultEmptyMessage = this.$t('CONVERSATION.REPLY_MESSAGE_NOT_FOUND');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -17,6 +19,9 @@ const cleanedContent = computed(() => extractTextFromMarkdown(content));
|
||||
class="p-2 -mx-2 overflow-hidden rounded-md bg-woot-600 line-clamp-3 min-w-[15rem] mb-2 cursor-pointer"
|
||||
@click="$emit('click')"
|
||||
>
|
||||
{{ cleanedContent }}
|
||||
<template v-if="content">
|
||||
{{ cleanedContent }}
|
||||
</template>
|
||||
<template v-else> {{ defaultEmptyMessage }} </template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user