Add keyboard shorts dialog and enable Ctrl+S in the editor

This commit is contained in:
Yang Zhang
2017-04-14 22:25:39 +08:00
parent 750e2ee677
commit 56ad3251fd
@@ -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(){