From 9f15de41f350db0f6ecda9aa7dd141999fe716e9 Mon Sep 17 00:00:00 2001 From: aryanshridhar Date: Sat, 8 May 2021 18:52:44 +0530 Subject: [PATCH] drafts: Allow vim up and down key to scroll between drafts. Added a fix to bind vim_up(k) and vim_down(j) keys with the draft section, allowing users to scroll between the drafts using 'k' (scroll up) and 'j'(scroll down) keys. Fixes #18397 --- static/js/drafts.js | 4 ++-- static/js/hotkey.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/drafts.js b/static/js/drafts.js index 70ab6bed23..feebe50590 100644 --- a/static/js/drafts.js +++ b/static/js/drafts.js @@ -471,13 +471,13 @@ export function drafts_handle_events(e, event_key) { // This detects up arrow key presses when the draft overlay // is open and scrolls through the drafts. - if (event_key === "up_arrow") { + if (event_key === "up_arrow" || event_key === "vim_up") { drafts_scroll(row_before_focus()); } // This detects down arrow key presses when the draft overlay // is open and scrolls through the drafts. - if (event_key === "down_arrow") { + if (event_key === "down_arrow" || event_key === "vim_down") { drafts_scroll(row_after_focus()); } diff --git a/static/js/hotkey.js b/static/js/hotkey.js index b28b7b2ade..2e33e1acb7 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -569,6 +569,8 @@ export function process_hotkey(e, hotkey) { switch (event_name) { case "up_arrow": case "down_arrow": + case "vim_up": + case "vim_down": case "backspace": case "delete": if (overlays.drafts_open()) {