This commit is contained in:
btzr-io 2018-06-21 14:16:55 -06:00
parent 4d22c7ea10
commit b3ed3e6d1a

View file

@ -55,16 +55,20 @@ class FileExporter extends React.PureComponent<Props> {
],
};
remote.dialog.showSaveDialog(remote.getCurrentWindow(), options, filename => {
// User hit cancel so do nothing:
if (!filename) return;
// Get extension and remove initial dot
const format = path.extname(filename).replace(/\./g, '');
// Parse data to string with the chosen format
const parsed = parseData(data, format, filters);
// Write file
parsed && this.handleFileCreation(filename, parsed);
});
remote.dialog.showSaveDialog(
remote.getCurrentWindow(),
options,
filename => {
// User hit cancel so do nothing:
if (!filename) return;
// Get extension and remove initial dot
const format = path.extname(filename).replace(/\./g, '');
// Parse data to string with the chosen format
const parsed = parseData(data, format, filters);
// Write file
parsed && this.handleFileCreation(filename, parsed);
}
);
}
render() {