Fix several issues around browser back navigation (#825)

This commit is contained in:
Sascha Ißbrücker
2024-09-15 08:28:49 +02:00
committed by GitHub
parent 74e65bc366
commit db225d5267
10 changed files with 64 additions and 23 deletions

View File

@@ -23,9 +23,8 @@
<option value="bulk_unshare">Unshare</option>
{% endif %}
</select>
<div class="tag-autocomplete d-none">
<input ld-tag-autocomplete variant="small"
name="bulk_tag_string" class="form-input input-sm" placeholder="Tag names...">
<div class="tag-autocomplete d-none" ld-tag-autocomplete>
<input name="bulk_tag_string" class="form-input input-sm" placeholder="Tag names..." variant="small">
</div>
<button ld-confirm-button type="submit" name="bulk_execute" class="btn btn-link btn-sm">
<span>Execute</span>

View File

@@ -19,9 +19,9 @@
The form has been pre-filled with the existing bookmark, and saving the form will update the existing bookmark.
</div>
</div>
<div class="form-group">
<div class="form-group" ld-tag-autocomplete>
<label for="{{ form.tag_string.id_for_label }}" class="form-label">Tags</label>
{{ form.tag_string|add_class:"form-input"|attr:"ld-tag-autocomplete"|attr:"autocomplete:off"|attr:"autocapitalize:off" }}
{{ form.tag_string|add_class:"form-input"|attr:"autocomplete:off"|attr:"autocapitalize:off" }}
<div class="form-input-hint">
Enter any number of tags separated by space and <strong>without</strong> the hash (#).
If a tag does not exist it will be automatically created.

View File

@@ -89,9 +89,9 @@
}
const apiClient = new linkding.ApiClient('{% url 'bookmarks:api-root' %}')
const input = document.querySelector('#search input[name="q"]')
const wrapper = document.createElement('div')
const container = document.createElement('div')
new linkding.SearchAutoComplete({
target: wrapper,
target: container,
props: {
name: 'q',
placeholder: 'Search for words or #tags',
@@ -103,6 +103,12 @@
search,
}
})
input.replaceWith(wrapper.firstElementChild);
const autoComplete = container.firstElementChild;
input.replaceWith(autoComplete);
document.addEventListener("turbo:before-cache", () => {
autoComplete.replaceWith(input);
}, {once: true});
})();
</script>