tags-input: validate last value when pasting.
This commit is contained in:
parent
618dc6aeae
commit
38946121b7
@ -191,12 +191,14 @@ export class TagsInputElement extends LivechatElement {
|
|||||||
values = values.map(v => v.trim()).filter(v => v !== '')
|
values = values.map(v => v.trim()).filter(v => v !== '')
|
||||||
|
|
||||||
if (values.length > 0) {
|
if (values.length > 0) {
|
||||||
// Keep last value in input if value doesn't finish with a separator
|
// 20240613: i disable this code, i think it is not a good idea.
|
||||||
if (!newValue.match(/\s+$/m)?.[0]?.includes(this.separator)) {
|
// // Keep last value in input if value doesn't finish with a separator
|
||||||
target.value = values.pop() ?? ''
|
// if (!newValue.match(/\s+$/m)?.[0]?.includes(this.separator)) {
|
||||||
} else {
|
// target.value = values.pop() ?? ''
|
||||||
|
// } else {
|
||||||
|
// target.value = ''
|
||||||
|
// }
|
||||||
target.value = ''
|
target.value = ''
|
||||||
}
|
|
||||||
// no duplicate
|
// no duplicate
|
||||||
this.value = [...new Set([...this.value, ...values])]
|
this.value = [...new Set([...this.value, ...values])]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user