From e4d8aafb9bc5b4c0a60546f582713c3debd31857 Mon Sep 17 00:00:00 2001 From: Ilya Y <75578537+ilya-bkv@users.noreply.github.com> Date: Thu, 1 Feb 2024 23:46:54 +0300 Subject: [PATCH] fix iframe size in article (#389) --- src/components/Article/FullArticle.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index c04615a0..9710b2ae 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -294,6 +294,7 @@ export const FullArticle = (props: Props) => { const updateIframeSizes = () => { if (!articleContainer?.current || !props.article.body) return const iframes = articleContainer?.current?.querySelectorAll('iframe') + console.log('!!! iframes:', iframes) if (!iframes) return const containerWidth = articleContainer.current?.offsetWidth iframes.forEach((iframe) => { @@ -308,6 +309,8 @@ export const FullArticle = (props: Props) => { const aspectRatio = width / height iframe.style.width = `${containerWidth}px` iframe.style.height = `${Math.round(containerWidth / aspectRatio) + 40}px` + } else { + iframe.style.height = `${containerWidth}px` } }) }