Skip to content

Commit 65bf9b3

Browse files
committed
fix: fill preview viewport when email is shorter than it
1 parent 6ebd625 commit 65bf9b3

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/server/ui/pages/Preview.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ function updateIframeContentHeight() {
241241
242242
// Temporarily collapse to measure true content height
243243
iframe.style.height = '0'
244-
iframeContentHeight.value = doc.documentElement.scrollHeight
244+
const contentHeight = doc.documentElement.scrollHeight
245+
// Fill the preview viewport when the email is shorter than it; grow past it
246+
// (and let the ScrollArea scroll) when the email is taller.
247+
const availableHeight = viewport?.clientHeight ?? 0
248+
iframeContentHeight.value = Math.max(contentHeight, availableHeight)
245249
iframe.style.height = `${iframeContentHeight.value}px`
246250
247251
// Restore scroll position

0 commit comments

Comments
 (0)