From 32d224f15c5608505d62e78c3f5fe3714ac83b0f Mon Sep 17 00:00:00 2001 From: 7PH Date: Sun, 21 Apr 2024 13:04:54 +0200 Subject: [PATCH] Show quotes in a single line by default --- .../src/components/message/SingleMessage.vue | 45 ++++++++++++++----- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/app/client/src/components/message/SingleMessage.vue b/app/client/src/components/message/SingleMessage.vue index 3287708e..228b1734 100644 --- a/app/client/src/components/message/SingleMessage.vue +++ b/app/client/src/components/message/SingleMessage.vue @@ -11,6 +11,8 @@ import UserMiniAvatarCollection from '@/components/user/UserMiniAvatarCollection const app = useAppStore(); const client = useClientStore(); +const COMPACT_QUOTES_MAX_LENGTH = 30; + const emit = defineEmits(['content-size-changed']); const props = defineProps({ @@ -26,18 +28,26 @@ const props = defineProps({ type: Boolean, default: false, }, - forceExpand: { - type: Boolean, - default: false, - }, showDate: { type: Boolean, default: false, }, }); +// Content ref const content = ref(null); +// Force expand (quotes) +const forceExpand = ref(false); +const showCompact = computed(() => { + return props.compact && !forceExpand.value; +}); +watch(showCompact, () => { + nextTick(() => { + emit('content-size-changed'); + }); +}); + const isBlacklisted = computed(() => { if (!client.state.user) { return false; @@ -154,7 +164,7 @@ const messageInteract = () => {