diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index c3de21053..2a00c5321 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -1171,6 +1171,14 @@ define([ var href = Messages.mdToolbar_tutorial; common.openUnsafeURL(href); }).appendTo($toolbar); + + $toolbar.on('keydown', function (e) { + if (e.key === 'Escape' || e.keyCode === 27) { + editor.focus(); + e.preventDefault(); + } + }); + return $toolbar; }; UIElements.createMarkdownToolbar = function (common, editor, opts) {