mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-11 10:06:35 +02:00
Remove choice from choices list when duplicateItems is false
This commit is contained in:
parent
9af97cad51
commit
7a784270b2
|
@ -1392,14 +1392,14 @@ class Choices {
|
|||
} else {
|
||||
let isUnique;
|
||||
if (!duplicateItems) {
|
||||
isUnique = !this.store
|
||||
existingChoice = !this.store
|
||||
.getItems()
|
||||
.some((item) => item.value === value.trim());
|
||||
.filter((item) => item.value === value.trim());
|
||||
}
|
||||
if (duplicateItems || isUnique) {
|
||||
if (duplicateItems) {
|
||||
this._addChoice(true, false, value, value);
|
||||
} else {
|
||||
this._addItem(value);
|
||||
this._addItem(existingChoice.value, existingChoice.label, existingChoice.id);
|
||||
}
|
||||
this.containerOuter.focus();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue