drawio icon indicating copy to clipboard operation
drawio copied to clipboard

Autosave in embed mode

Open Irillit opened this issue 7 years ago • 1 comments

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?

Irillit avatar Sep 10 '19 14:09 Irillit

I solved it like that:

  1. I used callback in template event. With it after creation of document draw.io sends 'template' event. I used: JSON.stringify({action: "template", callback: true, name: 'Sample'})
  2. 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.

Irillit avatar Sep 13 '19 07:09 Irillit