adds demo show_settings_menu

adds keyboard shortcut on init

adds keyboard shortcut on init
This commit is contained in:
nightwing 2013-04-13 20:52:58 +04:00
commit 3adba8eb21
4 changed files with 69 additions and 8 deletions

View file

@ -61,7 +61,7 @@ define(function(require, exports, module) {
* ☭ Hial Atropa!! ☭
* @param {ace.Editor} editor An instance of the ace editor.
*/
module.exports.showKeyboardShortcuts = function showKeyboardShortcuts (editor) {
function showKeyboardShortcuts (editor) {
// make sure the menu isn't open already.
if(!document.getElementById('kbshortcutmenu')) {
var overlayPage = require('./menu_tools/overlay_page').overlayPage;
@ -79,7 +79,17 @@ define(function(require, exports, module) {
overlayPage(editor, el, '0', '0', '0', null);
}
};
Editor.prototype.showKeyboardShortcuts = function () {
module.exports.showKeyboardShortcuts(this);
module.exports.init = function (editor) {
Editor.prototype.showKeyboardShortcuts = function () {
showKeyboardShortcuts(this);
};
editor.commands.addCommands([{
name: "showKeyboardShortcuts",
bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
exec: function(editor, line) {
editor.showKeyboardShortcuts();
}
}]);
};
});

View file

@ -384,15 +384,25 @@ define(function(require, exports, module) {
* ☭ Hial Atropa!! ☭
* @param {ace.Editor} editor An instance of the ace editor.
*/
module.exports.showSettingsMenu = function showSettingsMenu (editor) {
function showSettingsMenu (editor) {
// make sure the menu isn't open already.
if(!document.getElementById('settingsmenu')) {
addEditorMenuOptions(editor);
generateMenu(editor);
}
};
Editor.prototype.showSettingsMenu = function () {
module.exports.showSettingsMenu(this);
};
module.exports.init = function (editor) {
Editor.prototype.showSettingsMenu = function () {
showSettingsMenu(this);
};
editor.commands.addCommands([{
name: "showSettingsMenu",
bindKey: {win: "Ctrl-q", mac: "Command-q"},
exec: function(editor, line) {
editor.showSettingsMenu();
},
readOnly: true
}]);
};
});