frontend/app/components/notes/content.vue

41 lines
1.3 KiB
Vue
Raw Normal View History

2024-11-30 02:19:32 +01:00
<template>
2025-12-09 22:32:22 +01:00
<ContentWarning
v-if="(note.sensitive || note.spoiler_text) && preferences.show_content_warning"
2025-12-09 22:32:22 +01:00
v-model="hidden"
/>
2024-12-07 15:16:45 +01:00
2025-12-09 22:32:22 +01:00
<OverflowGuard
v-if="note.content"
2025-12-09 22:32:22 +01:00
:character-count="characterCount"
:class="(hidden && preferences.show_content_warning) && 'hidden'"
>
<Prose v-html="note.content" v-render-emojis="note.emojis"></Prose>
2025-04-10 14:48:03 +02:00
</OverflowGuard>
2024-11-30 16:39:02 +01:00
2025-12-09 22:32:22 +01:00
<Attachments
v-if="note.media_attachments.length > 0"
:attachments="note.media_attachments"
2025-12-09 22:32:22 +01:00
:class="(hidden && preferences.show_content_warning) && 'hidden'"
/>
<div v-if="note.quote" class="mt-4 rounded border overflow-hidden">
<Note :note="note.quote" :hide-actions="true" :small-layout="true" />
2024-11-30 16:39:02 +01:00
</div>
2024-11-30 02:19:32 +01:00
</template>
<script lang="ts" setup>
import Attachments from "./attachments.vue";
2025-04-10 14:48:03 +02:00
import ContentWarning from "./content-warning.vue";
2024-11-30 16:39:02 +01:00
import Note from "./note.vue";
2025-04-10 14:48:03 +02:00
import OverflowGuard from "./overflow-guard.vue";
import Prose from "./prose.vue";
import { key } from "./provider";
2024-11-30 16:39:02 +01:00
// biome-ignore lint/style/noNonNullAssertion: We want an error if not provided
const { note } = inject(key)!;
2025-04-10 14:48:03 +02:00
const hidden = ref(note.sensitive || !!note.spoiler_text);
const characterCount = note.text?.length;
2024-11-30 02:19:32 +01:00
</script>