diff --git a/renderer.js b/renderer.js index 522c5d4..2eff279 100644 --- a/renderer.js +++ b/renderer.js @@ -1137,6 +1137,32 @@ previewMDorHTML.addEventListener('click', () => { } }) +previewmdButton.addEventListener('click', () => { + if (currentFilePath === null) { + openModal(unsavedFile) + return + } + if (changes.textContent === 'Unsaved Changes') { + openModal(unsavedFile) + return + } + // Ignore file extension + ipcRenderer.send('previewinwindow', applyMDTemplate(editorTextarea.value)) +}) + +previewhtmlButton.addEventListener('click', () => { + if (currentFilePath === null) { + openModal(unsavedFile) + return + } + if (changes.textContent === 'Unsaved Changes') { + openModal(unsavedFile) + return + } + // Ignore file extension + ipcRenderer.send('previewinwindow', applyHTMLTemplate(editorTextarea.value)) +}) + toggleFullScreenButton.addEventListener('click', () => { toggleFullScreen() })