Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions resources/views/mails/preview.blade.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div class="w-full h-screen">
<div style="width: 100%; height: 75vh;">
<iframe
srcdoc="{{ $html }}"
sandbox
referrerpolicy="no-referrer"
title="{{ __('Email preview') }}"
class="w-full h-full max-w-full" style="width: 100vw; height: 100vh; border: none;">
style="display: block; width: 100%; height: 100%; border: none;">
</iframe>
</div>
10 changes: 10 additions & 0 deletions tests/MailRouteSecurityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,13 @@ function downloadUrl(Mail $mail, $attachment): string
->toContain('referrerpolicy="no-referrer"')
->not->toContain('src="');
});

it('sizes the inline preview to its container rather than the viewport', function () {
$preview = view('mails::mails.preview', ['html' => '<p>Preview</p>'])->render();

// A viewport-wide frame inside a narrower card puts a centred email past
// the card's right edge, so the preview looks empty.
expect($preview)
->toContain('width: 100%')
->not->toContain('100vw');
});