Closed yT0n1 closed 3 years ago
Maybe this should be tied to the event bus, to only fire when the diagram is in a "dirty" state? Otherwise, it might be annoying if I save the diagram and am still forced to confirm that I want to close the window.
I agree that that would probably be the better implementation. In that case, it would also make sense to add similar behavior to the "new diagram button" as well as the "open from disk" button. However, the implementation is quite a bit more work. We will have to write a module and inject it. As far as I remember we do not expose the event-bus to the outside. So I would prefer e merging the currently proposed solution and adding the better behavior at a later point in time.
The bpmn-js demo https://demo.bpmn.io/ manages to do it without injecting anything, by tapping into modeler.on('commandStack.changed', modelUpdate);
and then setting a dirty
flag which is cleared on save or load.
Maybe we can do it like that? Seems relatively minimal and elegant. 🙂
I completely overlooked modeler.on() 😅. I made the necessary changes.
Fixes #48