Firstly, [list]the file name should not be `./lib/mian.js` but be `./lib/active-file.js`.
Secondly, in line 15 of the following code:
saveHtml () {
// Render the content in Markdown as HTML using the Marked library
const html = marked(this.content, { sanitize: true })
const file = dialog.showSaveDialog(this.browserWindow, {
title: 'Save HTML',
// Default to the user's "documents" directory as defined by the operating system.
defaultPath: app.getPath('documents'),
filters: [
{ name: 'HTML Files', extensions: ['html'] }
]
})
// If the user selects cancel in the file dialog, abort the function.
if (!this.file) { return }
fs.writeFileSync(file, html)
}
if (!this.file) should be if (!file)
|