Skip to content

fix: fix image export for non-webpack bundlers - #3266

Merged
igorDykhta merged 6 commits into
masterfrom
igr/fix-image-export-latest
Dec 24, 2025
Merged

fix: fix image export for non-webpack bundlers #3266
igorDykhta merged 6 commits into
masterfrom
igr/fix-image-export-latest

Conversation

@igorDykhta

Copy link
Copy Markdown
Collaborator
  • fix image export for non-webpack bundlers
  • fix image export for the latest electron versions

Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes image export functionality for non-webpack bundlers (e.g., Vite) and modern Electron versions by switching from URL-encoded SVG data URIs to base64-encoded data URIs and adding auto-detection of the build tool being used.

Key Changes:

  • Replaced svgToMiniDataURI with base64 encoding to avoid URL encoding issues in Electron's security restrictions
  • Added automatic webpack detection via isWebpackBuild() function to conditionally apply XHTML escaping fixes
  • Updated default export image configuration to use auto-detected build tool settings

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

File Description
src/utils/src/dom-to-image.ts Switched from svgToMiniDataURI to base64 encoding for SVG data URIs, using Buffer in Node.js and btoa in browsers
src/utils/src/application-config.ts Added isWebpackBuild() detection function and new escapeXhtmlForWebpack configuration option with auto-detection
src/reducers/src/ui-state-updaters.ts Updated DEFAULT_EXPORT_IMAGE to read escapeXhtmlForWebpack from application config instead of hardcoding to true

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/utils/src/dom-to-image.ts Outdated
Comment thread src/utils/src/dom-to-image.ts Outdated
Comment thread src/reducers/src/ui-state-updaters.ts
Comment thread src/utils/src/application-config.ts Outdated
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 5 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/reducers/src/ui-state-updaters.ts Outdated
Comment thread src/utils/src/dom-to-image.ts
Comment thread src/utils/src/application-config.ts
Comment thread src/utils/src/dom-to-image.ts
Comment thread src/utils/src/application-config.ts
Comment thread src/utils/src/dom-to-image.ts
Signed-off-by: Ihor Dykhta <dikhta.igor@gmail.com>
@igorDykhta
igorDykhta merged commit 2d98598 into master Dec 24, 2025
8 checks passed
@igorDykhta
igorDykhta deleted the igr/fix-image-export-latest branch December 24, 2025 14:25
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.

3 participants