UX: allows to copy/paste a list of | separated values in sk (#11642)

* UX: allows to copy/paste a list of | separated values in sk

* fixes tests
This commit is contained in:
Joffrey JAFFEUX
2021-01-06 12:57:13 +01:00
committed by GitHub
parent 5f846531a5
commit 53f9a0883e
6 changed files with 66 additions and 4 deletions

View File

@@ -15,4 +15,25 @@ export default SelectKitFilterComponent.extend({
}
return isEmpty(placeholder) ? "" : I18n.t(placeholder);
},
actions: {
onPaste(event) {
const data = event.originalEvent.clipboardData;
if (!data) {
return;
}
const parts = data.getData("text").split("|").filter(Boolean);
if (parts.length > 1) {
event.stopPropagation();
event.preventDefault();
this.selectKit.append(parts);
return false;
}
},
},
});