New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ELECTRON-978 (Implement native file picker modal window) #540
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
js/preload/preloadMain.js
Outdated
const browserWindow = remote.getCurrentWindow(); | ||
const { type, title, defaultPath, multiSelect, filters } = options; | ||
const properties = [ type ]; | ||
if (multiSelect) properties.push('multiSelections'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use braces around the if statement for consistency.
js/preload/preloadMain.js
Outdated
const properties = [ type ]; | ||
if (multiSelect) properties.push('multiSelections'); | ||
remote.dialog.showOpenDialog(browserWindow, { title, defaultPath, properties, filters }, (filePaths) => { | ||
if (!filePaths) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use braces around the if statement for consistency.
js/preload/preloadMain.js
Outdated
const files = filePaths.map((file) => { | ||
const mimeType = mime.lookup(file); | ||
const filename = file.substring(file.lastIndexOf('/') + 1); | ||
return new File([ fs.readFileSync(file) ], filename, { type: mimeType }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the file(s) is big & the system is slow, the UI thread will be blocked. Please use async
version.
We don't need this work around anymore as the issue has been fixed on Electron framework electron/electron#16340 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Exposes an API to the web app to open a native file picker modal ELECTRON-978
Solution Approach
Expose an API which invokes
dialog.showOpenDialog
inturnScreenshot
Related PRs
List related PRs against other branches / repositories:
QA Checklist