Merge pull request #1229 from ProgramFan/feature-5.x/add-keyboard-shortcuts-dialog
Add keyboard shortcuts dialog. Closes #505.
This commit is contained in:
@@ -64,6 +64,29 @@
|
|||||||
editor.getSession().on('change', function(){
|
editor.getSession().on('change', function(){
|
||||||
textarea.val(editor.getSession().getValue());
|
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(){
|
$("#gollum-editor-body-ace").resize(function(){
|
||||||
|
|||||||
Reference in New Issue
Block a user