Update search text with search query

This commit is contained in:
guemax 2024-07-12 10:24:45 +02:00
parent 8fe663da80
commit 475f645a1e
No known key found for this signature in database
GPG key ID: 85916548E34D20A0

View file

@ -152,14 +152,22 @@ export default {
return _this.getPreferenceBoolean("searchHistory", false) && localStorage.getItem("search_history");
},
},
watch: {
$route() {
this.updateSearchTextFromURLSearchParams();
},
},
mounted() {
this.fetchAuthConfig();
const query = new URLSearchParams(window.location.search).get("search_query");
if (query) this.onSearchTextChange(query);
this.updateSearchTextFromURLSearchParams();
this.focusOnSearchBar();
this.homePagePath = this.getHomePage(this);
},
methods: {
updateSearchTextFromURLSearchParams() {
const query = new URLSearchParams(window.location.search).get("search_query");
if (query) this.onSearchTextChange(query);
},
// focus on search bar when Ctrl+k is pressed
focusOnSearchBar() {
hotkeys("ctrl+k", event => {