mirror of https://github.com/zulip/zulip.git
compose_ui: Add shortcut for code spans.
This commit is contained in:
parent
f4d109c289
commit
6c7b7665ea
|
@ -404,6 +404,8 @@ export function handle_keydown(
|
|||
type = "italic";
|
||||
} else if (key === "l" && event.shiftKey) {
|
||||
type = "link";
|
||||
} else if (key === "c" && event.shiftKey) {
|
||||
type = "code";
|
||||
}
|
||||
|
||||
// detect Cmd and Ctrl key
|
||||
|
@ -1013,6 +1015,7 @@ export function format_text(
|
|||
break;
|
||||
}
|
||||
case "code": {
|
||||
// Ctrl + Shift + C: Toggle code syntax on selection.
|
||||
const inline_code_syntax = "`";
|
||||
let block_code_syntax_start = "```\n";
|
||||
let block_code_syntax_end = "\n```";
|
||||
|
|
|
@ -129,6 +129,7 @@ This text won't be visible until the user clicks.
|
|||
def zulip():
|
||||
print "Zulip"
|
||||
\`\`\``,
|
||||
usage_html: format_usage_html("Ctrl", "Shift", "C"),
|
||||
},
|
||||
{
|
||||
markdown: `\
|
||||
|
|
|
@ -1179,6 +1179,15 @@ run_test("markdown_shortcuts", ({override_rewire}) => {
|
|||
compose_ui.handle_keydown(event, $("textarea#compose-textarea"));
|
||||
assert.equal(format_text_type, "link");
|
||||
format_text_type = undefined;
|
||||
|
||||
// Test code block insertion:
|
||||
// Mac = Cmd+Shift+C
|
||||
// Windows/Linux = Ctrl+Shift+C
|
||||
event.key = "c";
|
||||
event.shiftKey = true;
|
||||
compose_ui.handle_keydown(event, $("textarea#compose-textarea"));
|
||||
assert.equal(format_text_type, "code");
|
||||
format_text_type = undefined;
|
||||
}
|
||||
|
||||
// This function cross tests the Cmd/Ctrl + Markdown shortcuts in
|
||||
|
|
Loading…
Reference in New Issue