2
0
mirror of https://github.com/frappe/books.git synced 2025-02-03 04:28:32 +00:00

fix how the download path is calculated

This commit is contained in:
Ankit Singhaniya 2021-08-18 23:27:06 +05:30 committed by 18alantom
parent 17d607ef14
commit 11e3474e8d

View File

@ -90,24 +90,21 @@ export default {
let html = this.$refs.printContainer.innerHTML; let html = this.$refs.printContainer.innerHTML;
makePDF(html, destination); makePDF(html, destination);
}, },
getSavePath() { async getSavePath() {
return new Promise(resolve => { const options = {
remote.dialog.showSaveDialog(
remote.getCurrentWindow(),
{
title: this._('Select folder'), title: this._('Select folder'),
defaultPath: `${this.name}.pdf` defaultPath: `${this.name}.pdf`
}, };
filePath => {
let { filePath } = await remote.dialog.showSaveDialog(options);
console.log(filePath);
if (filePath) { if (filePath) {
if (!filePath.endsWith('.pdf')) { if (!filePath.endsWith('.pdf')) {
filePath = filePath + '.pdf'; filePath = filePath + '.pdf';
} }
resolve(filePath);
} }
}
); return filePath;
});
} }
} }
}; };