FIX: Restore support for pasting multiple PM recipients (#11945)

This is a regression from 98201ecc24.

Meta topic: https://meta.discourse.org/t/-/178167?u=osama.

Signed-off-by: OsamaSayegh <asooomaasoooma90@gmail.com>
This commit is contained in:
Osama Sayegh 2021-02-03 18:06:16 +03:00 committed by GitHub
parent 024f2720f3
commit db7b7eed9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,35 @@
import MultiSelectFilterComponent from "select-kit/components/multi-select/multi-select-filter";
export default MultiSelectFilterComponent.extend({
classNames: ["email-group-user-chooser-filter"],
actions: {
onPaste(event) {
const data = event.originalEvent.clipboardData;
if (!data) {
return;
}
const recipients = [];
data
.getData("text")
.split(/[, \n]+/)
.forEach((recipient) => {
recipient = recipient.replace(/^@+/, "").trim();
if (recipient.length > 0) {
recipients.push(recipient);
}
});
if (recipients.length > 0) {
event.stopPropagation();
event.preventDefault();
this.selectKit.append(recipients);
return false;
}
},
},
});

View File

@ -12,6 +12,7 @@ export default UserChooserComponent.extend({
selectKitOptions: {
headerComponent: "email-group-user-chooser-header",
filterComponent: "email-group-user-chooser-filter",
autoWrap: false,
},