Skip to content

Commit

Permalink
Add preview buttons for markdown and HTML files
Browse files Browse the repository at this point in the history
  • Loading branch information
LyubomirT committed Feb 10, 2024
1 parent da49ae9 commit 4b73e0d
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down

0 comments on commit 4b73e0d

Please sign in to comment.