Add an option to automatically select uploaded files... #63
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.
...when they have been uploaded using the + Add button next to the Selector field's label.
I extended the JS code to listen to changes of the file input field once when
autoselectadd
is set totrue
. The JS code basically parses out the name of the files to be uploaded and manipulates the value of the hidden$storage
field. The final step is to programmatically submit the nearest html form such that the selection is saved. I've tested it with Kirbyv2.5.2
and it works fine for single and multi Selector fields.The biggest chunk was extracted from Kirby itself, namely the file name sanitizing function.