menus will open only 1 at a time per menu.
This commit is contained in:
parent
4ec0a6e706
commit
52a1dffa9f
3 changed files with 25 additions and 21 deletions
|
|
@ -45,11 +45,6 @@ exports.commands = [{
|
|||
name: "showSettingsMenu",
|
||||
bindKey: bindKey("Ctrl-,", "Command-,"),
|
||||
exec: function (editor) {
|
||||
config.loadModule("ace/ext/show_keyboard_shortcuts", function (e) {
|
||||
e(editor);
|
||||
});
|
||||
},
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectall",
|
||||
bindKey: bindKey("Ctrl-A", "Command-A"),
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
var overlayPage = require('./overlay_page').overlayPage;
|
||||
var getEditorKeybordShortcuts = require('./get_editor_keyboard_shortcuts').getEditorKeybordShortcuts;
|
||||
/**
|
||||
* Generates a menu which displays the keyboard shortcuts.
|
||||
* @author <a href="mailto:matthewkastor@gmail.com">
|
||||
|
|
@ -30,15 +28,22 @@ define(function(require, exports, module) {
|
|||
* ☭ Hial Atropa!! ☭
|
||||
* @param {ace.Editor} editor An instance of the ace editor.
|
||||
*/
|
||||
module.exports = function showKeyboardShortcuts (editor) {
|
||||
var kb = getEditorKeybordShortcuts(editor);
|
||||
var el = document.createElement('div');
|
||||
var commands = kb.reduce(function (previous, current) {
|
||||
return previous + '<div><b>' + current.command + '</b> : ' +
|
||||
current.key + '</div>';
|
||||
}, '');
|
||||
el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands;
|
||||
el.style.cssText = 'margin:0; padding:0;';
|
||||
overlayPage(el, '0', '0', '0', null);
|
||||
module.exports.showKeyboardShortcuts = function showKeyboardShortcuts (editor) {
|
||||
// make sure the menu isn't open already.
|
||||
if(!document.getElementById('kbshortcutmenu')) {
|
||||
var overlayPage = require('./overlay_page').overlayPage;
|
||||
var getEditorKeybordShortcuts = require('./get_editor_keyboard_shortcuts').getEditorKeybordShortcuts;
|
||||
var kb = getEditorKeybordShortcuts(editor);
|
||||
var el = document.createElement('div');
|
||||
var commands = kb.reduce(function (previous, current) {
|
||||
return previous + '<div><b>' + current.command + '</b> : ' +
|
||||
current.key + '</div>';
|
||||
}, '');
|
||||
|
||||
el.id = 'kbshortcutmenu';
|
||||
el.innerHTML = '<h1>Keyboard Shortcuts</h1>' + commands + '</div>';
|
||||
el.style.cssText = 'margin:0; padding:0;';
|
||||
overlayPage(el, '0', '0', '0', null);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -188,6 +188,7 @@ define(function(require, exports, module) {
|
|||
*/
|
||||
function wrapElements() {
|
||||
var topmenu = document.createElement('div');
|
||||
topmenu.id = 'settingsmenu';
|
||||
elements.forEach(function (element) {
|
||||
topmenu.appendChild(element);
|
||||
});
|
||||
|
|
@ -364,9 +365,12 @@ define(function(require, exports, module) {
|
|||
* ☭ Hial Atropa!! ☭
|
||||
* @param {ace.Editor} editor An instance of the ace editor.
|
||||
*/
|
||||
module.exports = function (editor) {
|
||||
addFunctionsForSettingsMenu(editor);
|
||||
addEditorMenuOptions(editor);
|
||||
generateMenu(editor);
|
||||
module.exports.showSettingsMenu = function showSettingsMenu (editor) {
|
||||
// make sure the menu isn't open already.
|
||||
if(!document.getElementById('settingsmenu')) {
|
||||
addFunctionsForSettingsMenu(editor);
|
||||
addEditorMenuOptions(editor);
|
||||
generateMenu(editor);
|
||||
}
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue