UX: Skip special paste handling in email-group-user-chooser when maximum is 1 (#17124)

`email-group-user-chooser` currently handles paste events to allow users to paste multiple entries at once instead of entering them one by one. This behavior makes sense when the component is used in scenarios where it makes sense to provide multiple entries such as the recipients field when creating a PM. However, for instances where the component accepts only 1 entry, it doesn't make a lot of sense to do custom handling of paste events.

This commit makes our paste event handler a NOOP when the component is configured to accept only 1 entry in which case pasting will simply input the value into the component's search field.
This commit is contained in:
Osama Sayegh 2022-06-17 16:53:50 +03:00 committed by GitHub
parent 91bc4442d1
commit b0a896a10f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,10 @@ export default MultiSelectFilterComponent.extend({
@action
onPaste(event) {
if (this.selectKit.options.maximum === 1) {
return;
}
const data = event.originalEvent.clipboardData;
if (!data) {