Skip to content

Fix: resolve print not working for electron - #693

Open
dcoffin88 wants to merge 2 commits into
maathimself:mainfrom
dcoffin88:fix/message-page-print-button-electron
Open

dcoffin88 wants to merge 2 commits into
maathimself:mainfrom
dcoffin88:fix/message-page-print-button-electron

Conversation

@dcoffin88

@dcoffin88 dcoffin88 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes email printing in Electron.

Changes

  • Fixed both print buttons on electron apps.

Testing

  • Fully tested in my dev and prod environments

Contributor License Agreement

By submitting this pull request I confirm that:

  • I have read and agree to the Contributor License Agreement.
  • My contribution is my own original work (or I have identified any
    third-party material and confirmed it is compatible with the CLA).
  • I have the right to submit this contribution under the terms of the CLA.

@maathimself

Copy link
Copy Markdown
Owner

Thanks, the cause is right: the desktop app's window-open handler denies the blank window printing opens, so Print silently did nothing there. The windowOpening change that allows only a named mailflow-print window from the app's own origin is the fix we want.

Could you split this PR?

  1. This PR: just the fix, the named print window plus the windowOpening allowance and its tests. Please also give the print window its own webPreferences without the main preload: as it is, the hidden window holding the email HTML gets the full mailflowNative bridge. CSP and DOMPurify keep scripts out today, but it shouldn't be one layer away.
  2. The print preview (page ranges, Save as PDF, selection only, the context-menu Print) as a feature: per CONTRIBUTING, please open an issue first so we can agree on it. Things it would need: "Print selection only" copies the reading pane's DOM after dark recoloring (Support inverted mail body (dark mode mail body) #228), so in dark themes it prints light text on white; the preview and its errors need translations; the context-menu Print shows for any selection or image in the window but prints the open message; a failed print:open leaves the hidden window alive, which can keep the app from quitting on Windows and Linux without a tray; and pdf.js loading from file:// inside app.asar needs checking in a packaged build.

Once the fix is split out I'll test it on the desktop builds and merge it.

@dcoffin88
dcoffin88 force-pushed the fix/message-page-print-button-electron branch from 737ab2f to f4495d6 Compare October 28, 2026 22:03
@dcoffin88 dcoffin88 changed the title Fix: resolve print not working and implement print dialog for electron Fix: resolve print not working for electron Oct 28, 2026
@dcoffin88

Copy link
Copy Markdown
Contributor Author
  • Removed the feature.
  • The print window now has its own web preferences with the main preload cleared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants