From 0435cc5f2de25f8bde93bdd4ca2132ed6b887373 Mon Sep 17 00:00:00 2001 From: FineArchs <133759614+FineArchs@users.noreply.github.com> Date: Tue, 13 Feb 2024 07:05:35 +0900 Subject: [PATCH 1/2] Update MkNote.vue --- packages/frontend/src/components/MkNote.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 03a283cab33b..812284b5b1f1 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -56,7 +56,7 @@ SPDX-License-Identifier: AGPL-3.0-only

-
+
({{ i18n.ts.private }}) @@ -90,7 +90,7 @@ SPDX-License-Identifier: AGPL-3.0-only -
+
{{ appearNote.channel.name }}
@@ -254,8 +254,9 @@ const isMyRenote = $i && ($i.id === note.value.userId); const showContent = ref(false); const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null); const urls = computed(() => parsed.value ? extractUrlFromMfm(parsed.value).filter((url) => appearNote.value.renote?.url !== url && appearNote.value.renote?.uri !== url) : null); -const isLong = shouldCollapsed(appearNote.value, urls.value ?? []); -const collapsed = ref(appearNote.value.cw == null && isLong); +const collapsibleInner = ref(null); +const isLong = computed(() => (!!collapsibleInner.value) && (collapsibleInner.value.clientHeight > 9 * parseFloat(getComputedStyle(collapsibleInner.value).fontSize))); +const collapsed = ref(appearNote.value.cw == null); const isDeleted = ref(false); const muted = ref(checkMute(appearNote.value, $i?.mutedWords)); const hardMuted = ref(props.withHardMute && checkMute(appearNote.value, $i?.hardMutedWords, true)); From 924f9ed8990a4460c7c8705d2ea0cd376e7e4a2d Mon Sep 17 00:00:00 2001 From: FineArchs <133759614+FineArchs@users.noreply.github.com> Date: Tue, 13 Feb 2024 07:48:55 +0900 Subject: [PATCH 2/2] use onMounted --- packages/frontend/src/components/MkNote.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 812284b5b1f1..386d41298b10 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -216,6 +216,11 @@ const currentClip = inject | null>('currentClip', nul const note = ref(deepClone(props.note)); +onMounted(() => { + isLong.value = collapsibleInner.value.clientHeight > 9 * parseFloat(getComputedStyle(collapsibleInner.value).fontSize); + collapsed.value &&= isLong.value; +}); + // plugin if (noteViewInterruptors.length > 0) { onMounted(async () => { @@ -255,7 +260,7 @@ const showContent = ref(false); const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null); const urls = computed(() => parsed.value ? extractUrlFromMfm(parsed.value).filter((url) => appearNote.value.renote?.url !== url && appearNote.value.renote?.uri !== url) : null); const collapsibleInner = ref(null); -const isLong = computed(() => (!!collapsibleInner.value) && (collapsibleInner.value.clientHeight > 9 * parseFloat(getComputedStyle(collapsibleInner.value).fontSize))); +const isLong = ref(false); const collapsed = ref(appearNote.value.cw == null); const isDeleted = ref(false); const muted = ref(checkMute(appearNote.value, $i?.mutedWords));