mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
hotkeys: Move copy_with_c shortcut definition and improve comments.
The `copy_handler` function that this shortcut calls is not useful unless the body of a Zulip message is selected, so we shouldn't try running it in other situations.
This commit is contained in:
@@ -759,7 +759,7 @@ export function process_hotkey(e, hotkey) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compose box hotkeys
|
// Shortcuts that are useful with an empty message feed, like opening compose.
|
||||||
switch (event_name) {
|
switch (event_name) {
|
||||||
case "compose": // 'c': compose
|
case "compose": // 'c': compose
|
||||||
compose_actions.start("stream", {trigger: "compose_hotkey"});
|
compose_actions.start("stream", {trigger: "compose_hotkey"});
|
||||||
@@ -781,16 +781,14 @@ export function process_hotkey(e, hotkey) {
|
|||||||
case "star_deprecated":
|
case "star_deprecated":
|
||||||
ui.maybe_show_deprecation_notice("*");
|
ui.maybe_show_deprecation_notice("*");
|
||||||
return true;
|
return true;
|
||||||
case "copy_with_c":
|
|
||||||
copy_and_paste.copy_handler();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message_lists.current.empty()) {
|
if (message_lists.current.empty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Navigation shortcuts
|
// Shortcuts for navigation and other applications that require a
|
||||||
|
// nonempty message feed but do not depend on the selected message.
|
||||||
switch (event_name) {
|
switch (event_name) {
|
||||||
case "down_arrow":
|
case "down_arrow":
|
||||||
case "vim_down":
|
case "vim_down":
|
||||||
@@ -817,6 +815,9 @@ export function process_hotkey(e, hotkey) {
|
|||||||
case "spacebar":
|
case "spacebar":
|
||||||
navigate.page_down();
|
navigate.page_down();
|
||||||
return true;
|
return true;
|
||||||
|
case "copy_with_c":
|
||||||
|
copy_and_paste.copy_handler();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const msg = message_lists.current.selected_message();
|
const msg = message_lists.current.selected_message();
|
||||||
|
|||||||
Reference in New Issue
Block a user