mirror of https://github.com/bastienwirtz/homer
fix(search): Allow usage of the hotkey in the text
parent
36d753df58
commit
31f7cfa09f
|
@ -29,7 +29,7 @@ export default {
|
||||||
emits: ["search-open", "search-focus", "search-cancel", "input"],
|
emits: ["search-open", "search-focus", "search-cancel", "input"],
|
||||||
mounted() {
|
mounted() {
|
||||||
this._keyListener = function (event) {
|
this._keyListener = function (event) {
|
||||||
if (event.key === this.hotkey) {
|
if (!this.hasFocus() && event.key === this.hotkey) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.focus();
|
this.focus();
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,9 @@ export default {
|
||||||
this.$refs.search.focus();
|
this.$refs.search.focus();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
hasFocus: function () {
|
||||||
|
return document.activeElement == this.$refs.search
|
||||||
|
},
|
||||||
setSearchURL: function (value) {
|
setSearchURL: function (value) {
|
||||||
const url = new URL(window.location);
|
const url = new URL(window.location);
|
||||||
if (value === "") {
|
if (value === "") {
|
||||||
|
|
Loading…
Reference in New Issue