fix: export png incorrectly when svg without width and height #6146
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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