Fixed Chips: Able to separate pasted value by new line (#5098)

pull/5110/head
yendefrr 2024-01-18 12:30:21 +03:00 committed by GitHub
parent 48aa388953
commit 90c1e5b559
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -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];