-
Notifications
You must be signed in to change notification settings - Fork 967
Fix screenshot mode for email body (iframes) #2581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| el = doc.createElement('style'); | ||
| el.id = 'screenshot-mode-styles'; | ||
| el.innerText = getStyleText(); | ||
| doc.head.appendChild(el); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential null reference: doc.head could be null for documents without a head element (e.g., third-party iframes). While unlikely in practice since email iframes are created with doc.write() which includes a DOCTYPE, adding a guard would make this more robust: if (doc.head) { doc.head.appendChild(el); }
| return 'Mailspring' + (thread ? ' · ' + thread.subject : ''); | ||
| } | ||
|
|
||
| function getStyleText() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor performance optimization: This reads the CSS file synchronously on every call, which happens on toggle and for every new message rendered. Consider caching the result in a module-level variable since the CSS content is static.
|
I think this will resolve #1044! |
This PR fixes an issue where "Screenshot Mode" did not hide or blur text inside email body iframes.
ScreenshotModeMessageExtension(usingMessageViewExtension) to inject styles into email body iframes upon rendering.Before

After
