drawio
drawio copied to clipboard
Autosave in embed mode
Hello, I've already seen this link. I'm trying to implement autosave, it works for me when I load file, but I'm a bit confused when I create it from template. It's said on article that template is normally sent instead of a load message to create an initial diagram. Load message has autosave feature. What's recommened to do if I need autosave when I create new file?
I solved it like that:
- I used
callbackin template event. With it after creation of document draw.io sends 'template' event. I used:JSON.stringify({action: "template", callback: true, name: 'Sample'}) - With callback I added handler and loaded document with autosave:
if (msg.event === 'template') {
action: "load",
autosave: 1,
xml: msg.xml
}
If I did something wrong, please, let me know.