Skip to content

Restore PDF previews on Electron 41 by avoiding iframe-based embedding#3072

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-pdf-previews-electron-v41
Draft

Restore PDF previews on Electron 41 by avoiding iframe-based embedding#3072
Copilot wants to merge 2 commits intomainfrom
copilot/fix-pdf-previews-electron-v41

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

PDF previews in frontend/app/view/preview/ stopped rendering after the Electron 41 upgrade and failed inside Electron’s sandboxed PDF path. This change moves PDF preview rendering off the iframe codepath that regressed while preserving the existing streamed file URL behavior.

  • Preview rendering

    • Replace the PDF preview <iframe> with native <object> / <embed> embedding in preview-streaming.tsx.
    • Keep the existing /wave/stream-file?... URL generation unchanged, so the backend/file streaming behavior stays the same.
  • Targeted coverage

    • Add a focused renderer test for StreamingPreview that verifies:
      • PDFs render through object/embed
      • the old iframe path is no longer used
      • the streamed PDF URL is still constructed correctly
  • Relevant shape of the change

    if (fileInfo.mimetype === "application/pdf") {
        return (
            <div className="flex flex-row h-full overflow-hidden items-center justify-center p-[5px]">
                <object data={streamingUrl} type="application/pdf" width="100%" height="100%">
                    <embed src={streamingUrl} type="application/pdf" width="100%" height="100%" />
                </object>
            </div>
        );
    }
    • Not included: the available screenshot did not clearly show a successful rendered PDF preview.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 15, 2026

Deploying waveterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 1a8bca5
Status: ✅  Deploy successful!
Preview URL: https://4e7fa1a7.waveterm.pages.dev
Branch Preview URL: https://copilot-fix-pdf-previews-ele.waveterm.pages.dev

View logs

Copilot AI changed the title [WIP] Fix PDF previews not working in Electron v41 Restore PDF previews on Electron 41 by avoiding iframe-based embedding Mar 15, 2026
Copilot AI requested a review from sawka March 15, 2026 22:05
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