Closed adamburczy closed 3 years ago
Hello @adamburczy
Yes is possible.
View to save object in localstorage: https://stackoverflow.com/questions/2010892/storing-objects-in-html5-localstorage
Use editor.export()
and editor.import()
to save and load.
Jero
Thanks for your reply @jerosoler ! It's working, I can get the JSON object, with nodes using editor.export() and editor.import(), but I have one more question, and I will be happy, if you could help me. Im not sure if I understand those methods. I have JSON object, and I can save it to the localStorage with storage.setItem(keyName, keyVale), but how can I add those created nodes from JSON into DOM?
Hello, @adamburczy
With the function editor.import("YOUR JSON");
It should load its nodes into the DOM.
Jero
Hello, when I create nodes non-programmatically, for example using drag and drop on demo: https://jerosoler.github.io/Drawflow/, after I refresh page, everything I added disappear. Is there way to keep it after page refresh for example, storing it to LocalStorage, and then adding to HTML code of page?