diff --git a/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js b/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js index c55c9e19..fd0bcc3f 100755 --- a/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js +++ b/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js @@ -196,7 +196,9 @@ LanguageDefinition.getHookFunctionFor("activate")(); } - function hotkey( cmd ) { + function hotkey( e, cmd ) { + e.preventDefault(); + var def = LanguageDefinition.getDefinitionFor( cmd ); if ( typeof def == 'object' ) { FunctionBar.executeAction( def ); @@ -205,9 +207,13 @@ return false; } - Mousetrap.bind(['command+b', 'ctrl+b'], function(){ hotkey('function-bold'); }); - Mousetrap.bind(['command+i', 'ctrl+i'], function(){ hotkey('function-italic'); }); - Mousetrap.bind(['command+s', 'ctrl+s'], function(){ + Mousetrap.bind(['command+1', 'ctrl+1'], function( e ){ hotkey( e, 'function-h1' ); }); + Mousetrap.bind(['command+2', 'ctrl+2'], function( e ){ hotkey( e, 'function-h2' ); }); + Mousetrap.bind(['command+3', 'ctrl+3'], function( e ){ hotkey( e, 'function-h3' ); }); + Mousetrap.bind(['command+b', 'ctrl+b'], function( e ){ hotkey( e, 'function-bold' ); }); + Mousetrap.bind(['command+i', 'ctrl+i'], function( e ){ hotkey( e, 'function-italic' ); }); + Mousetrap.bind(['command+s', 'ctrl+s'], function( e ){ + e.preventDefault(); $("#gollum-editor-submit").trigger("click"); return false; });