mirror of https://github.com/zulip/zulip.git
saved_snippets: Add keyboard UI for inserting a saved snippet.
Adds `Ctrl+'` keyboard shortcut to open saved snippet dropdown. Fixes #31829.
This commit is contained in:
parent
4b4b6c5ebe
commit
1cd20bcfef
|
@ -125,6 +125,7 @@ const keydown_cmd_or_ctrl_mappings = {
|
||||||
75: {name: "search_with_k", message_view_only: false}, // 'K'
|
75: {name: "search_with_k", message_view_only: false}, // 'K'
|
||||||
83: {name: "star_message", message_view_only: true}, // 'S'
|
83: {name: "star_message", message_view_only: true}, // 'S'
|
||||||
190: {name: "narrow_to_compose_target", message_view_only: true}, // '.'
|
190: {name: "narrow_to_compose_target", message_view_only: true}, // '.'
|
||||||
|
222: {name: "open_saved_snippet_dropdown", message_view_only: true}, // '''
|
||||||
};
|
};
|
||||||
|
|
||||||
const keydown_alt_mappings = {
|
const keydown_alt_mappings = {
|
||||||
|
@ -847,6 +848,16 @@ export function process_hotkey(e, hotkey) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event_name === "open_saved_snippet_dropdown" && compose_state.composing()) {
|
||||||
|
$("#send_later i").trigger("click");
|
||||||
|
// This timeout makes the saved snippet dropdown to appear at the intended
|
||||||
|
// position relative to the "Saved snippets" button in the `send_later`
|
||||||
|
// popover.
|
||||||
|
setTimeout(() => {
|
||||||
|
$("#saved_snippets_widget")[0].click();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Process hotkeys specially when in an input, select, textarea, or send button
|
// Process hotkeys specially when in an input, select, textarea, or send button
|
||||||
if (processing_text()) {
|
if (processing_text()) {
|
||||||
// Note that there is special handling for Enter/Esc too, but
|
// Note that there is special handling for Enter/Esc too, but
|
||||||
|
|
Loading…
Reference in New Issue