Skip to content

Commit

Permalink
Fixed Chips: Able to separate pasted value by new line (#5098)
Browse files Browse the repository at this point in the history
  • Loading branch information
yendefrr committed Jan 18, 2024
1 parent 48aa388 commit 90c1e5b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/lib/chips/Chips.vue
Expand Up @@ -140,11 +140,12 @@ export default {
},
onPaste(event) {
if (this.separator) {
let separator = this.separator.replace('\\n', '\n').replace('\\r', '\r').replace('\\t', '\t');
let pastedData = (event.clipboardData || window['clipboardData']).getData('Text');
if (pastedData) {
let value = this.modelValue || [];
let pastedValues = pastedData.split(this.separator);
let pastedValues = pastedData.split(separator);
pastedValues = pastedValues.filter((val) => this.allowDuplicate || value.indexOf(val) === -1);
value = [...value, ...pastedValues];
Expand Down

0 comments on commit 90c1e5b

Please sign in to comment.