DEV: Use @action decorator (#11955)

Follow up to db7b7eed9d
This commit is contained in:
Osama Sayegh 2021-02-04 06:41:53 +03:00 committed by GitHub
parent d518b302a0
commit 97b55af9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 23 deletions

View File

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