Implement search keybind

This commit is contained in:
Violet Millie 2024-01-26 15:33:00 +00:00
parent 37d4d377e4
commit 262e871ca3
2 changed files with 34 additions and 0 deletions

View File

@ -1,8 +1,10 @@
import type KeybindManager from "./KeybindManager";
import ComposeKeybind from "./keybinds/ComposeKeybind";
import SearchKeybind from "./keybinds/SearchKeybind";
export default async function (keybindManager: KeybindManager) {
keybindManager.registerKeybind(ComposeKeybind);
keybindManager.registerKeybind(SearchKeybind);
}

View File

@ -0,0 +1,32 @@
import type { Keybind } from "../KeybindManager";
const keybind: Keybind = {
key: "s",
execute: function () {
const buttonElement = document.querySelector(
"button.nav-icon:nth-child(1)"
);
if (!buttonElement) {
return;
}
const button = buttonElement as HTMLElement;
button.click();
const inputElement = document.querySelector("#search-bar-input");
if (!inputElement) {
return;
}
const input = inputElement as HTMLElement;
input.focus();
},
};
export default keybind;