From 90c1e5b559eace17c8681d872a7e4519123c7acc Mon Sep 17 00:00:00 2001 From: yendefrr Date: Thu, 18 Jan 2024 12:30:21 +0300 Subject: [PATCH] Fixed Chips: Able to separate pasted value by new line (#5098) --- components/lib/chips/Chips.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/lib/chips/Chips.vue b/components/lib/chips/Chips.vue index 1f10dd96b..8263033c7 100755 --- a/components/lib/chips/Chips.vue +++ b/components/lib/chips/Chips.vue @@ -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];