How to get an alert when close the tab (without saving)?

HI,

how to get an alert when we close the tab (only when modeler has edited).
Here is step by step explanation

1> I launched my modeler
2> I drawn some shapes
3> I did not save that and closing the tab ,here i’m looking for alert

Thanks in advance

I assume you’re referring to the demo.bpmn.io page’s behavior.

You can check wether the diagram is dirty through the command stack:

const commandStack = modeler.get('commandStack');

const dirty = commandStack.canUndo();

As for confirming:

2 Likes