diff --git a/demo/show_keyboard_shortcuts.html b/demo/show_keyboard_shortcuts.html index e4f42a65..8d456c5b 100644 --- a/demo/show_keyboard_shortcuts.html +++ b/demo/show_keyboard_shortcuts.html @@ -31,8 +31,8 @@ diff --git a/demo/show_settings_menu.html b/demo/show_settings_menu.html new file mode 100644 index 00000000..b23d9a6b --- /dev/null +++ b/demo/show_settings_menu.html @@ -0,0 +1,41 @@ + + +
+ + +function foo(items) {
+ var i;
+ for (i = 0; i < items.length; i++) {
+ alert("Ace Rocks " + items[i]);
+ }
+}
+
+
+
+
+
+
+
diff --git a/lib/ace/ext/show_keyboard_shortcuts.js b/lib/ace/ext/show_keyboard_shortcuts.js
index a15dbe41..d7405aa7 100644
--- a/lib/ace/ext/show_keyboard_shortcuts.js
+++ b/lib/ace/ext/show_keyboard_shortcuts.js
@@ -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();
+ }
+ }]);
};
+
});
\ No newline at end of file
diff --git a/lib/ace/ext/show_settings_menu.js b/lib/ace/ext/show_settings_menu.js
index 7c94e420..75c7fe88 100644
--- a/lib/ace/ext/show_settings_menu.js
+++ b/lib/ace/ext/show_settings_menu.js
@@ -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
+ }]);
+ };
});
\ No newline at end of file