tidy up
This commit is contained in:
parent
4d22c7ea10
commit
b3ed3e6d1a
1 changed files with 14 additions and 10 deletions
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue