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 8dee8aef..53f24e31 100755 --- a/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js +++ b/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js @@ -24,7 +24,6 @@ * You don't need to do anything. Just run this on DOM ready. */ $.GollumEditor = function( IncomingOptions ) { - ActiveOptions = $.extend( DefaultOptions, IncomingOptions ); debug('GollumEditor loading'); @@ -96,11 +95,8 @@ $('#gollum-editor-help').hide(); $('#gollum-editor-help').removeClass('jaws'); } - - } - // EditorHas.functionBar - } - // EditorHas.baseEditorMarkup + } // EditorHas.functionBar + } // EditorHas.baseEditorMarkup }; @@ -199,6 +195,18 @@ if(LanguageDefinition.getHookFunctionFor("activate")) { LanguageDefinition.getHookFunctionFor("activate")(); } + + function hotkey( cmd ) { + var def = LanguageDefinition.getDefinitionFor( cmd ); + if ( typeof def == 'object' ) { + FunctionBar.executeAction( def ); + } + // Prevent bubbling of hotkey. + return false; + } + + Mousetrap.bind(['command+b', 'ctrl+b'], function(){ hotkey('function-bold'); }); + Mousetrap.bind(['command+i', 'ctrl+i'], function(){ hotkey('function-italic'); }); } ); } else { LanguageDefinition._ACTIVE_LANG = name; diff --git a/lib/gollum/frontend/templates/editor.mustache b/lib/gollum/frontend/templates/editor.mustache index d81cd4ec..94c7fd51 100644 --- a/lib/gollum/frontend/templates/editor.mustache +++ b/lib/gollum/frontend/templates/editor.mustache @@ -88,7 +88,7 @@ + data-markup-lang="{{format}}" name="content" class="mousetrap">{{content}} {{#header}}