From 4d22c7ea10a7d2450ff79fcc895792d8282a0959 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Thu, 21 Jun 2018 14:11:14 -0600 Subject: [PATCH 1/2] prevent interaction while file / folder dialog is open --- CHANGELOG.md | 2 ++ src/renderer/component/common/file-exporter.jsx | 3 +-- src/renderer/component/common/file-selector.jsx | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 005f86c54..34d050f5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). * Fix Linux upgrade path and add manual installation note ([#1606](https://github.com/lbryio/lbry-app/issues/1606)) * Fix can type in unfocused fields while publishing without selecting file ([#1456](https://github.com/lbryio/lbry-app/issues/1456)) * Fix navigation button resulting incorrect page designation ([#1502](https://github.com/lbryio/lbry-app/issues/1502)) + * Fix shouldn't allow to open multiple export and choose file dialogs ([#1175](https://github.com/lbryio/lbry-app/issues/1175)) + ## [0.21.6] - 2018-06-05 diff --git a/src/renderer/component/common/file-exporter.jsx b/src/renderer/component/common/file-exporter.jsx index 8ab48e05c..d426c1583 100644 --- a/src/renderer/component/common/file-exporter.jsx +++ b/src/renderer/component/common/file-exporter.jsx @@ -2,7 +2,6 @@ import fs from 'fs'; import path from 'path'; import React from 'react'; -import PropTypes from 'prop-types'; import Button from 'component/button'; import parseData from 'util/parseData'; import * as icons from 'constants/icons'; @@ -56,7 +55,7 @@ class FileExporter extends React.PureComponent { ], }; - remote.dialog.showSaveDialog(options, filename => { + remote.dialog.showSaveDialog(remote.getCurrentWindow(), options, filename => { // User hit cancel so do nothing: if (!filename) return; // Get extension and remove initial dot diff --git a/src/renderer/component/common/file-selector.jsx b/src/renderer/component/common/file-selector.jsx index d07d52dbb..ec19394e1 100644 --- a/src/renderer/component/common/file-selector.jsx +++ b/src/renderer/component/common/file-selector.jsx @@ -25,6 +25,7 @@ class FileSelector extends React.PureComponent { handleButtonClick() { remote.dialog.showOpenDialog( + remote.getCurrentWindow(), { properties: this.props.type === 'file' ? ['openFile'] : ['openDirectory', 'createDirectory'], -- 2.45.2 From b3ed3e6d1abd83b25faa883387401151de372965 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Thu, 21 Jun 2018 14:16:55 -0600 Subject: [PATCH 2/2] tidy up --- .../component/common/file-exporter.jsx | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/renderer/component/common/file-exporter.jsx b/src/renderer/component/common/file-exporter.jsx index d426c1583..fe32fa1d4 100644 --- a/src/renderer/component/common/file-exporter.jsx +++ b/src/renderer/component/common/file-exporter.jsx @@ -55,16 +55,20 @@ class FileExporter extends React.PureComponent { ], }; - 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() { -- 2.45.2