diff --git a/lib/gollum/public/gollum/javascript/editor/gollum.editor.js b/lib/gollum/public/gollum/javascript/editor/gollum.editor.js index 1b03b61e..8c213749 100755 --- a/lib/gollum/public/gollum/javascript/editor/gollum.editor.js +++ b/lib/gollum/public/gollum/javascript/editor/gollum.editor.js @@ -64,6 +64,29 @@ editor.getSession().on('change', function(){ textarea.val(editor.getSession().getValue()); }); + + editor.commands.addCommand({ + name: "showKeyboardShortcuts", + bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"}, + exec: function(editor) { + ace.config.loadModule("ace/ext/keybinding_menu", function(module) { + module.init(editor); + editor.showKeyboardShortcuts(); + }); + } + }); + + // Ace editor seems to capture all keyboard events so gollum's global + // shortcuts does not work in the editor area. So we add them back in + // the editor as commands. These commands are added back on-demand since + // not all gollum shortcuts are necessary in the presence of Ace editor. + editor.commands.addCommand({ + name: "saveContents", + bindKey: {win: "Ctrl-s", mac: "Command-s"}, + exec: function(editor) { + $('#gollum-editor form[name="gollum-editor"]').submit(); + } + }); }); $("#gollum-editor-body-ace").resize(function(){