Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
require('fs').writeFile(filename, fileContent, (err) => {
if (err) throw err
})
}
else {
FileSaver.saveAs(
new Blob(
[fileContent],
{ type: 'text/html;charset=utf-8' }
),
filename
)
}
this.filename = filename
SessionStorage.set(CONTENT_LAST_SAVED_KEY, this.contentHTML)
/* Hack to recompute 'isCHanged' property */
this.contentHTML = ' ' + this.contentHTML
this.contentHTML = this.contentHTML.substr(1)
/* */
}
else {
this.saveFileAs()
}
},
saveFileAs () {
reader.onload = (evt) => {
try {
var data = evt.target.result
this.filename = f.name.split('.')[0]
this.contentHTML = data
.split('')[1]
.replace('', '')
.replace('', '')
SessionStorage.set(CONTENT_LAST_SAVED_KEY, this.contentHTML)
}
catch (err) {
reader.onerror(err)
}
}
reader.onerror = (err) => {
mounted () {
window.onbeforeunload = this.exit
document.onkeyup = this.onKeyPress
document.title = this.windowTitle
this.$refs.layout.hideLeft()
this.contentHTML = LocalStorage.get.item(CONTENT_BACKUP_KEY) || DEFAULT_CONTENT_HTML
SessionStorage.set(CONTENT_LAST_SAVED_KEY, this.contentHTML)
document.querySelector('#editor').focus()
},
methods: {
registerLastSave (state, on) {
state.lastSaved = on || new Date()
SessionStorage.set(CONTENT_LAST_SAVED_KEY, state.contentHTML)
},
resetFile () {
SessionStorage.set(CONTENT_LAST_SAVED_KEY, DEFAULT_CONTENT_HTML)
this.contentHTML = DEFAULT_CONTENT_HTML
this.filename = null
},
newFile () {