Skip to content
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

Clicking to Attach a File Deletes First Element on Page with ID of "undefined" #1088

Open
chadrschroeder opened this issue Sep 18, 2023 · 0 comments · May be fixed by #1089
Open

Clicking to Attach a File Deletes First Element on Page with ID of "undefined" #1088

chadrschroeder opened this issue Sep 18, 2023 · 0 comments · May be fixed by #1089

Comments

@chadrschroeder
Copy link

chadrschroeder commented Sep 18, 2023

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant