Fix double tag input on back button

This commit is contained in:
Mark Veidemanis 2022-08-09 07:20:30 +01:00
parent 09e748db73
commit 62133a8cbb
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 8 additions and 4 deletions

View File

@ -362,9 +362,6 @@
</div>
<div class="block">
<input id="tags" class="input" type="tags" placeholder="Add query" value="{{ tags|joinsep:',' }}">
<script>
setupTags();
</script>
</div>
<div class="block">
<div id="results">

View File

@ -203,7 +203,14 @@
var inputTags = document.getElementsByClassName('tags-input');
var inputBox = document.querySelector("[placeholder='Add query']");
var isFocused = (document.activeElement === inputBox);
inputTags[0].outerHTML = '<input id="tags" class="input" type="tags" placeholder="Add query" value="{{ tags|joinsep:',' }}">';
for (index = 0; index < inputTags.length; index++) {
if (index == 0) {
inputTags[0].outerHTML = '<input id="tags" class="input" type="tags" placeholder="Add query" value="{{ tags|joinsep:',' }}">';
} else {
inputTags[index].remove();
}
}
// inputTags[0].outerHTML = '<input id="tags" class="input" type="tags" placeholder="Add query" value="{{ tags|joinsep:',' }}">';
setupTags();
var inputBox = document.querySelector("[placeholder='Add query']");
if (isFocused) {