mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 18:21:49 +08:00
* bugfix: #338 error message on export cancel * fixed the solution * put package-lock.json back
This commit is contained in:
parent
1073e650cc
commit
1f0b65d95c
@ -20,24 +20,26 @@ const handleResponseForExport = (e, { type, content, pathname }) => {
|
||||
defaultPath
|
||||
})
|
||||
|
||||
// If export PDF, the content will be undefined.
|
||||
if (!content && type === 'pdf') {
|
||||
win.webContents.printToPDF({ printBackground: true }, (err, data) => {
|
||||
if (err) log(err)
|
||||
else {
|
||||
writeFile(filePath, data, extension)
|
||||
.then(() => {
|
||||
win.webContents.send('AGANI::export-success', { type, filePath })
|
||||
})
|
||||
.catch(log)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
writeFile(filePath, content, extension)
|
||||
.then(() => {
|
||||
win.webContents.send('AGANI::export-success', { type, filePath })
|
||||
if (filePath) {
|
||||
// If export PDF, the content will be undefined.
|
||||
if (!content && type === 'pdf') {
|
||||
win.webContents.printToPDF({ printBackground: true }, (err, data) => {
|
||||
if (err) log(err)
|
||||
else {
|
||||
writeFile(filePath, data, extension)
|
||||
.then(() => {
|
||||
win.webContents.send('AGANI::export-success', { type, filePath })
|
||||
})
|
||||
.catch(log)
|
||||
}
|
||||
})
|
||||
.catch(log)
|
||||
} else {
|
||||
writeFile(filePath, content, extension)
|
||||
.then(() => {
|
||||
win.webContents.send('AGANI::export-success', { type, filePath })
|
||||
})
|
||||
.catch(log)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user