Browse Source

Fix tag autocomplete comparison to existing tags

merge-requests/76/head
Bauke 5 years ago
committed by Deimos
parent
commit
5d3794f08c
  1. 7
      tildes/static/js/behaviors/autocomplete-menu-item.js

7
tildes/static/js/behaviors/autocomplete-menu-item.js

@ -11,7 +11,12 @@ $.onmount("[data-js-autocomplete-menu-item]", function() {
var $tagsHiddenInput = $("[data-js-autocomplete-hidden-input]");
var $autocompleteInput = $("[data-js-autocomplete-input]");
if (!$tagsHiddenInput.val().includes(clickedSuggestionText + ",")) {
var existingTags = $tagsHiddenInput.val().split(",");
if (
existingTags.every(function(val) {
return val !== clickedSuggestionText;
})
) {
var $chips = $autocompleteContainer
.find("[data-js-autocomplete-chips]")
.first();

Loading…
Cancel
Save