+function drawEventSave(message) {
+ drawPostMessage({
+ action: 'export', format: 'xmlpng', xml: message.xml, spin: 'Updating drawing',
+ });
+}
+
+function drawEventInit() {
+ if (!onInit) return;
+ onInit().then(xml => {
+ drawPostMessage({action: 'load', autosave: 1, xml});
+ });
+}
+
+function drawEventConfigure() {
+ const config = {};
+ window.$events.emitPublic(iFrame, 'editor-drawio::configure', {config});
+ drawPostMessage({action: 'configure', config});
+}
+
+function drawEventClose() {
+ // eslint-disable-next-line no-use-before-define
+ window.removeEventListener('message', drawReceive);
+ if (iFrame) document.body.removeChild(iFrame);