mirror of https://github.com/zulip/zulip.git
ts: Convert keydown_util to TypeScript.
We also add JQuery to globals which is a global type.
This commit is contained in:
parent
6ab66ea17a
commit
7999d52400
|
@ -127,6 +127,9 @@
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"project": "tsconfig.json"
|
"project": "tsconfig.json"
|
||||||
},
|
},
|
||||||
|
"globals": {
|
||||||
|
"JQuery": false
|
||||||
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
// Disable base rule to avoid conflict
|
// Disable base rule to avoid conflict
|
||||||
"no-duplicate-imports": "off",
|
"no-duplicate-imports": "off",
|
||||||
|
|
|
@ -7,7 +7,12 @@ export const vim_down = "j";
|
||||||
export const vim_up = "k";
|
export const vim_up = "k";
|
||||||
export const vim_right = "l";
|
export const vim_right = "l";
|
||||||
|
|
||||||
export function handle(opts) {
|
export function handle(opts: {
|
||||||
|
elem: JQuery;
|
||||||
|
handlers: {
|
||||||
|
[handler: string]: (() => boolean) | undefined;
|
||||||
|
};
|
||||||
|
}): void {
|
||||||
opts.elem.on("keydown", (e) => {
|
opts.elem.on("keydown", (e) => {
|
||||||
if (e.altKey || e.ctrlKey || e.shiftKey) {
|
if (e.altKey || e.ctrlKey || e.shiftKey) {
|
||||||
return;
|
return;
|
Loading…
Reference in New Issue