hotkey.js: Navigate using page up / page down

Using page up / page down, go to the top / bottom of compose textarea

Fixes https://github.com/zulip/zulip/issues/7097
This commit is contained in:
Utkarsh Patil 2017-12-09 01:04:54 +04:00 committed by showell
parent 240511c2d7
commit 1093d88fa0
1 changed files with 3 additions and 2 deletions

View File

@ -536,11 +536,12 @@ exports.process_hotkey = function (e, hotkey) {
compose_actions.cancel();
// don't return, as we still want it to be picked up by the code below
} else if (event_name === "page_up") {
$("#compose-textarea").caret(0);
$("#compose-textarea").caret(0).animate({ scrollTop: 0 }, "fast");
return true;
} else if (event_name === "page_down") {
// so that it always goes to the end of the compose box.
$("#compose-textarea").caret(Infinity);
var height = $("#compose-textarea")[0].scrollHeight;
$("#compose-textarea").caret(Infinity).animate({ scrollTop: height }, "fast");
return true;
} else {
// Let the browser handle the key normally.