From 38946121b70803fe3d9f359bc444939fbaf2137f Mon Sep 17 00:00:00 2001 From: John Livingston Date: Thu, 13 Jun 2024 12:00:11 +0200 Subject: [PATCH] tags-input: validate last value when pasting. --- client/common/lib/elements/tags-input.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/client/common/lib/elements/tags-input.ts b/client/common/lib/elements/tags-input.ts index ad7f57a3..ce6592ee 100644 --- a/client/common/lib/elements/tags-input.ts +++ b/client/common/lib/elements/tags-input.ts @@ -191,12 +191,14 @@ export class TagsInputElement extends LivechatElement { values = values.map(v => v.trim()).filter(v => v !== '') if (values.length > 0) { - // Keep last value in input if value doesn't finish with a separator - if (!newValue.match(/\s+$/m)?.[0]?.includes(this.separator)) { - target.value = values.pop() ?? '' - } else { - target.value = '' - } + // 20240613: i disable this code, i think it is not a good idea. + // // Keep last value in input if value doesn't finish with a separator + // if (!newValue.match(/\s+$/m)?.[0]?.includes(this.separator)) { + // target.value = values.pop() ?? '' + // } else { + // target.value = '' + // } + target.value = '' // no duplicate this.value = [...new Set([...this.value, ...values])]