Skip to content
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

fix: export png incorrectly when svg without width and height #6146

Merged

Conversation

donteatfriedrice
Copy link
Member

To fix #5552

This issue is due to the fact that when the svg does not set the width and height, but only sets the viewBox, it will adaptively change the size, causing only a small part of the rendering result to be displayed. If the width and height of an svg are set correctly, the exported svg will be complete.

In order to solve this problem, special processing needs to be done when the img src is svg, and the width and height of svg need to be set.

Since there is no way to directly determine whether the img is of svg type from the url suffix of the img src, we need to fetch the blob first and then determine the blob type, which may cause the export time to become longer.

Screen.Recording.2024-01-29.at.16.19.11.mov

Copy link

vercel bot commented Jan 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 29, 2024 8:31am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2024 8:31am

Copy link
Member

@doodlewind doodlewind left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@doodlewind doodlewind merged commit 5291ede into toeverything:master Jan 30, 2024
19 checks passed
@donteatfriedrice donteatfriedrice deleted the fix/export-png-lost-svg branch January 30, 2024 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

SVG can't be displayed after exporting to PNG
2 participants