diff --git a/packages/client/src/components/MkNote.vue b/packages/client/src/components/MkNote.vue index 8c4570323d17..58a5dbe8ccce 100644 --- a/packages/client/src/components/MkNote.vue +++ b/packages/client/src/components/MkNote.vue @@ -42,7 +42,7 @@

-
+
({{ i18n.ts.private }}) @@ -61,10 +61,10 @@
- -
@@ -156,6 +156,17 @@ const isRenote = ( note.poll == null ); +const textEl = ref(); +let textElHeight = $ref(0); +onMounted(() => { + if (textEl.value) { + const resizeObserver = new ResizeObserver(() => { + textElHeight = textEl.value?.offsetHeight ?? 0; + }); + resizeObserver.observe(textEl.value); + } +}); + const el = ref(); const menuButton = ref(); const renoteButton = ref>(); @@ -164,16 +175,23 @@ const reactButton = ref(); let appearNote = $computed(() => isRenote ? note.renote as misskey.entities.Note : note); const isMyRenote = $i && ($i.id === note.userId || $i.isModerator || $i.isAdmin); const showContent = ref(false); -const isLong = (appearNote.cw == null && appearNote.text != null && ( - (appearNote.text.split('\n').length > 9) || - (appearNote.text.length > 500) -)); -const collapsed = ref(appearNote.cw == null && isLong); +const urls = appearNote.text ? extractUrlFromMfm(mfm.parse(appearNote.text)) : null; +const isLong = $computed(() => { + return !!( + appearNote.cw == null && + appearNote.text != null && ( + (textElHeight >= 500) || + (appearNote.files.length >= 5) || + (urls && urls.length >= 4) + ) + ); +}); +const collapsedFlag = ref(true); +const collapsed = $computed(() => isLong && collapsedFlag); const isDeleted = ref(false); const muted = ref(checkWordMute(appearNote, $i, defaultStore.state.mutedWords)); const translation = ref(null); const translating = ref(false); -const urls = appearNote.text ? extractUrlFromMfm(mfm.parse(appearNote.text)) : null; const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.user.instance); const keymap = {