From 23610e8c323acf83d1b4c82fd21c8411f31769c2 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Tue, 19 Nov 2024 09:09:15 +0900 Subject: [PATCH] unify postHeight --- packages/frontend/src/components/MkUrlPreview.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/frontend/src/components/MkUrlPreview.vue b/packages/frontend/src/components/MkUrlPreview.vue index e2f94b351a..e91297cc8c 100644 --- a/packages/frontend/src/components/MkUrlPreview.vue +++ b/packages/frontend/src/components/MkUrlPreview.vue @@ -32,7 +32,7 @@ SPDX-License-Identifier: AGPL-3.0-only allow="fullscreen;web-share" sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin" scrolling="no" - :style="{ position: 'relative', width: '100%', height: `${tweetHeight}px`, border: 0 }" + :style="{ position: 'relative', width: '100%', height: `${postHeight}px`, border: 0 }" :src="`https://platform.twitter.com/embed/index.html?embedId=${embedId}&hideCard=false&hideThread=false&lang=en&theme=${defaultStore.state.darkMode ? 'dark' : 'light'}&id=${tweetId}`" > @@ -48,7 +48,7 @@ SPDX-License-Identifier: AGPL-3.0-only allow="fullscreen;web-share" sandbox="allow-popups allow-popups-to-escape-sandbox allow-scripts allow-same-origin" scrolling="no" - :style="{ position: 'relative', width: '100%', height: `${bskyPostHeight}px`, border: 0 }" + :style="{ position: 'relative', width: '100%', height: `${postHeight}px`, border: 0 }" :src="`https://embed.bsky.app/embed/${bskyDid}/app.bsky.feed.post/${bskyPostRecordKey}?id=${embedId}`" > @@ -149,14 +149,13 @@ const playerEnabled = ref(false); const embedId = `embed${Math.random().toString().replace(/\D/, '')}`; const postExpanded = ref(props.detail); +const postHeight = ref(150); const tweetId = ref(null); -const tweetHeight = ref(150); const bskyHandleOrDid = ref(null); const bskyDid = ref(null); const bskyPostRecordKey = ref(null); -const bskyPostHeight = ref(150); const unknownUrl = ref(false); @@ -255,12 +254,12 @@ function adjustSocialsEmbedHeight(message: MessageEvent) { const embed = message.data?.['twttr.embed']; if (embed?.method === 'twttr.private.resize' && embed?.id === embedId) { const height = embed?.params[0]?.height; - if (height) tweetHeight.value = height; + if (height) postHeight.value = height; } } else if (message.origin === 'https://embed.bsky.app') { if (message.data?.id === embedId) { const height = message.data?.height; - if (height) bskyPostHeight.value = height; + if (height) postHeight.value = height; } } }