Open Vanshbordia opened 3 days ago
editor.store.loadSnapshot may help you
Is there an example for this, kind of trying to implement this for hours, could not seem to figure it out. If not that is what I was kind of asking for in the first place. https://tldraw.dev/examples/editor-api/snapshots Even this the snapshot Json is different from the json that we get when exporting /saving the file
If you see that there is a variation with your JSON, kindly check the version of TLdraw you are using. Because I am able to use getSnapshot and loadSnapshot from editor.store without any issues. Refer if needed
I am on version 2.3.0. Exporting from the website tldraw.com as well as the local version the json does not contain the same data that store or snapshot contains, the structure itself is different
Export is different from Snapshot. Snapshot contains Schema and store in json but export as json contains schema and shapes. Just use getSnapshot and loadSnapshot from editor.store for easier work.
What's the example?
Using store & persistent is useful to span the data across browser tabs, but I want to have a Component on the page with custom data passed to it, the store prop would make it persistent with other pages and cause issues. Is there a simpler way to just save / export from tldraw and host the file and pass the json / tldr file to render on my page.
Code of Conduct