Skip to content

Add Markdown editor keyboard shortcuts

Nathan Friend requested to merge nfriend-add-markdown-editor-shortcuts into master

What does this MR do?

Adds the ability to associate keyboard shortcuts with toolbar buttons in Markdown editors.

This MR implements three (hopefully) non-controversial shortcuts:

Action Mac shortcut Non-Mac shortcut
Bold +B Ctrl+B
Italic +I Ctrl+I
link +K Ctrl+K

This MR partially completes #17181

GIF

2020-08-27_15.48.56

Screenshots

Toolbar button tooltips now include the shortcut:

Screen_Shot_2020-08-27_at_3.52.22_PM

On non-Mac platforms, the tooltips read Ctrl+B instead of +B.

Update: Mac shortcut tooltips no longer have the + (for example, ⌘B). See !40328 (comment 408531767).

Testing locally

We have two implementations of our Markdown editors: one built with Vue, and one with Haml. It's important to test both of these implementation when testing locally. The Vue version can be tested on the New Release page (https://gitlab.example.com/user/project/-/releases/new); the Haml version can be tested on the New Snippet page (https://gitlab.example.com/-/snippets/new).

Edited by Nathan Friend

Merge request reports