diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts index 4d96854f..ad637441 100644 --- a/src/hooks/useSettings.ts +++ b/src/hooks/useSettings.ts @@ -71,8 +71,9 @@ export function useSettings({ relayPool, eventStore, pubkey, accountManager }: U // Set paragraph alignment root.setProperty('--paragraph-alignment', settings.paragraphAlignment || 'justify') - // Set image width based on full-width setting + // Set image width and max-height based on full-width setting root.setProperty('--image-width', settings.fullWidthImages ? '100%' : 'auto') + root.setProperty('--image-max-height', settings.fullWidthImages ? 'none' : '70vh') } diff --git a/src/styles/components/reader.css b/src/styles/components/reader.css index d5564d38..8da954b2 100644 --- a/src/styles/components/reader.css +++ b/src/styles/components/reader.css @@ -59,11 +59,12 @@ .reader .reader-html img, .reader .reader-markdown img { width: var(--image-width, auto); max-width: 100%; - max-height: 70vh; + max-height: var(--image-max-height, 70vh); height: auto; display: block; margin: 0.75rem auto; border-radius: 6px; + object-fit: contain; } /* Headlines with Tailwind typography */ .reader-markdown h1, .reader-html h1 { @@ -194,7 +195,9 @@ .reader-markdown img, .reader-html img { width: var(--image-width, auto) !important; max-width: 100% !important; + max-height: var(--image-max-height, 70vh) !important; height: auto; + object-fit: contain; } }