-
Notifications
You must be signed in to change notification settings - Fork 46
Export svg and style optimize #1133
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
3ba7866 to
e87c560
Compare
|
Hi @NaoCoding , please help me review this pr! |
NaoCoding
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pubuzhixing8 , is this a bug or it is normal behavior.
While I draw some lines on the board
The export svg does not show anything.
|
@NaoCoding I don't know what happen, all vector-line, mind, flow chart, image are expected in my local environment. |
NaoCoding
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. LGTM. I'll try to find out is there any potential issue.
I think it's ok to merge first.

This PR exports a new
toSvgmethod, enabling developers to programmatically export canvas content as an SVG file.We can implement the feature plait-board/drawnix#278.
Previously, the
toImagefeature was already implemented using an SVG-based solution. This change simply extracts the core SVG generation logic into a standalone, publicly availabletoSvgDatamethod line191.Additionally, I've optimized the inline HTML style handling to reduce SVG file size by omitting unnecessary styles for display purposes:
Selective Style Cloning: Instead of cloning all inline styles, only specific styles defined by the caller are now copied. This allows developers full control over which classes and styles are included 1.
Direct Text Style Transfer: Text styles from the Slate editor framework are cloned directly to ensure consistency 2.