diff --git a/src/renderer/plugins/markdown-drawio.ts b/src/renderer/plugins/markdown-drawio.ts index 8aa6f1d7..5e926eb2 100644 --- a/src/renderer/plugins/markdown-drawio.ts +++ b/src/renderer/plugins/markdown-drawio.ts @@ -276,6 +276,12 @@ function buildEditorSrcdoc (file: Doc) { iframe.style.border = 'none' iframe.setAttribute('frameborder', '0') + ${isElectron ? ` + window.onbeforeunload = evt => { + iframe.contentWindow.postMessage(JSON.stringify({ action: 'exit' }), '*'); + } + ` : ''} + const asPng = doc.path.endsWith('.png') const receive = async function (evt) {