-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
canvas.toDatalessJSON doesn't work with canvas.loadFromDatalessJSON when SVG sourcePath is set. #4560
Comments
smansker
changed the title
canvas.toDatalessJSON creates invalid JSON when SVG sourcePath is set.
canvas.toDatalessJSON doesn't work with canvas.loadFromDatalessJSON when SVG sourcePath is set.
Dec 14, 2017
The original title of this bug was misleading. Hopefully it makes more sense now. |
Yes, they appear to be the same issue. |
Facing same issue, as i see in jsoned object, attribute name is seemed to be changed, "objects":"/cliparts/svg/file.svg" now, and in your tutroial it was "path":"/assets/dragon.svg" |
duplicate of #4598 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
2.0.0-rc.3
Test Case
https://jsfiddle.net/smansker/j81Lrg5c/
Steps to reproduce
I am unable to use the datalessJSON serialize/deserialize methods with SVGs. Basically, it doesn't work if I include the sourcePath property, as per the tutorials.
First, I load an SVG into the canvas like so:
Now, if I call
JSON.stringify(canvas.toDatalessJSON())
the json that it outputs has the objects property set to the string that I passed in for the sourcePath property.If you pass the json into the
canvas.loadFromDatalessJSON(jsonStr, canvas.renderAll.bind(canvas))
, it throws an error: "objects.forEach is not a function."Expected Behavior
The serialized canvas data should be able to be deserialized back into the canvas, using toDatalessJSON and loadFromDatalessJSON, when my canvas contains SVG graphics.
Actual Behavior
It fails to load the serialized data into the canvas and generates an error.
The text was updated successfully, but these errors were encountered: