From fb9bc6d3f42b94804033935ba150468bd0535f89 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 13 Apr 2013 20:52:50 +0400 Subject: [PATCH] prettifies menu option labels removes "set" adds space before uppercase letters. focus handling focus handling --- lib/ace/ext/menu_tools/overlay_page.js | 4 +++- lib/ace/ext/show_keyboard_shortcuts.js | 2 +- lib/ace/ext/show_settings_menu.js | 11 +++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/ace/ext/menu_tools/overlay_page.js b/lib/ace/ext/menu_tools/overlay_page.js index 55e03c20..36de21d4 100644 --- a/lib/ace/ext/menu_tools/overlay_page.js +++ b/lib/ace/ext/menu_tools/overlay_page.js @@ -68,7 +68,7 @@ define(function(require, exports, module) { * @param {string|number} bottom absolute position value. * @param {string|number} left absolute position value. */ -module.exports.overlayPage = function overlayPage (contentElement, top, right, bottom, left) { +module.exports.overlayPage = function overlayPage (editor, contentElement, top, right, bottom, left) { top = (top) ? 'top: ' + top + ';' : ''; bottom = (bottom) ? 'bottom: ' + bottom + ';' : ''; right = (right) ? 'right: ' + right + ';' : ''; @@ -90,6 +90,7 @@ module.exports.overlayPage = function overlayPage (contentElement, top, right, b 'background-color: rgba(0, 0, 0, 0.2);'; closer.addEventListener('click', function () { closer.parentNode.removeChild(closer); + editor.focus(); closer = null; }); // click closer if esc key is pressed @@ -109,6 +110,7 @@ module.exports.overlayPage = function overlayPage (contentElement, top, right, b contentContainer.appendChild(contentElement); closer.appendChild(contentContainer); document.body.appendChild(closer); + editor.blur(); }; }); \ No newline at end of file diff --git a/lib/ace/ext/show_keyboard_shortcuts.js b/lib/ace/ext/show_keyboard_shortcuts.js index 24412833..14e44f75 100644 --- a/lib/ace/ext/show_keyboard_shortcuts.js +++ b/lib/ace/ext/show_keyboard_shortcuts.js @@ -75,7 +75,7 @@ define(function(require, exports, module) { el.id = 'kbshortcutmenu'; el.innerHTML = '

Keyboard Shortcuts

' + commands + ''; el.style.cssText = 'margin:0; padding:0;'; - overlayPage(el, '0', '0', '0', null); + overlayPage(editor, el, '0', '0', '0', null); } }; }); \ 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 c7951b48..5b87f0d9 100644 --- a/lib/ace/ext/show_settings_menu.js +++ b/lib/ace/ext/show_settings_menu.js @@ -229,7 +229,14 @@ define(function(require, exports, module) { div.setAttribute('class', 'menuEntry'); div.setAttribute('style', 'clear: both;'); - div.appendChild(egen.createLabel(item, item)); + div.appendChild(egen.createLabel( + item.replace( + /^set/, '' + ).replace( + /([A-Z])/g, ' $1' + ).trim(), + item + )); if(Array.isArray(val)) { el = egen.createSelection(item, val, clss); @@ -366,7 +373,7 @@ define(function(require, exports, module) { cleanupElementsList(); // dump the entries from the elements list and wrap them up in a div // then put the div into the generic menu and show it. - overlayPage(wrapElements(), '0', '0', '0'); + overlayPage(editor, wrapElements(), '0', '0', '0'); } /** * This builds the settings menu and selects