Description
While overriding the pickFiles
function, I noticed that there is no fileInputId
property to provide a unique ID for the dynamically inserted file input element.
Back in Trix version 1, that existed here and looked like:
fileInputId: "trix-file-input-#{Date.now().toString(16)}"
The entire pickFiles
function was removed here. Then that function was added back without fileInputId
here.
This means that if for some strange reason you had another element on the page with an id
of "undefined", clicking to add a file in Trix would remove that element.
Also, as a side question--would you be open to a pull request that adds a way to configure the accept
property on the pickFiles
input element? I need to restrict the types of files a user can select. I know I can check the file type in the trix-file-accept
event and call event.preventDefault()
there, but that happens after the user has already selected a file. It would be nice to be able to restrict the list of possible files while they are making the selection. (Update: I now see pull request #789 addresses this and has been open for over 3 years.)
Details
- Trix version: 2.0.5