Make possible to pick both files and folders#10936
Merged
MorrisJobke merged 4 commits intomasterfrom Aug 30, 2018
Merged
Conversation
When "enter" is pressed in the file picker a "click" event is triggered on the primary action button. However, in some cases, like when the file picker is in "Choose" mode and the current directory in the file picker is the root folder, the primary action button is disabled. In those cases pressing enter should not trigger a click action on the button and be ignored instead. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
When the mime type is an empty array no filter should be applied. However, the filter was loosely compared to an empty array, but as arrays are objects then it became an implicit strict equality comparison which always failed due to being different objects. Now the length of the array is compared instead, and also moved outside the loop as it is not needed to check it for each file. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This will make easier to check if both directories and files should be pickable. This also removes an unused assignment to the mime type. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
nickvergessen
approved these changes
Aug 30, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The file picker could be used to pick either files or folders, but not both. This pull request fixes that, as well as being able to choose a folder just by hitting enter even if the default action button was disabled, and wrong handling of an empty array as the mime type filter.
This change should be backwards compatible; when the filter is
undefinedor null only files can be picked, which is the same as before; in order to be able to pick both files and folders['*', 'httpd/unix-directory']should be explicitly used.