in themes/docsy/assets/js/drawio.js [40:67]
var handler = function (evt) {
var wind = iframe.contentWindow;
if (evt.data.length > 0 && evt.source == wind) {
var msg = JSON.parse(evt.data);
if (msg.event == 'init') {
wind.postMessage(JSON.stringify({action: 'load', xml: imgdata}), '*');
} else if (msg.event == 'save') {
var fmt = imgdata.indexOf('data:image/png') == 0 ? 'xmlpng' : 'xmlsvg';
wind.postMessage(JSON.stringify({action: 'export', format: fmt}), '*');
} else if (msg.event == 'export') {
const fn = img.src.replace(/^.*?([^/]+)$/, '$1');
const dl = document.createElement('a');
dl.setAttribute('href', msg.data);
dl.setAttribute('download', fn);
document.body.appendChild(dl);
dl.click();
dl.parentNode.removeChild(dl);
}
if (msg.event == 'exit' || msg.event == 'export') {
window.removeEventListener('message', handler);
closeFrame();
}
}
};