diff --git a/Makefile.dryice.js b/Makefile.dryice.js index 1e7952a9..4ecd397f 100755 --- a/Makefile.dryice.js +++ b/Makefile.dryice.js @@ -441,7 +441,7 @@ var buildAce = function(options) { if (options.shrinkwrap) { console.log('# combining files into one ---------'); copy({ - source: { root:targetDir, exclude:/^worker\-/ }, + source: { root:targetDir, exclude:/(^|\\|\/)worker\-[^\\\/]*\.js$/ }, dest: BUILD_DIR + '/ace-min.js' }); } diff --git a/build_support/editor_textarea.html b/build_support/editor_textarea.html index 9d878a1e..bb691c11 100644 --- a/build_support/editor_textarea.html +++ b/build_support/editor_textarea.html @@ -88,7 +88,7 @@ inject(function () { var ace = window.__ace_shadowed__; var t = document.querySelector("textarea"); textAce = ace.transformTextarea(t, window.__ace_loader__); - textAce.setDisplaySettings(true); + setTimeout(function(){textAce.setDisplaySettings(true)}); }); diff --git a/lib/ace/css/editor.css b/lib/ace/css/editor.css index 4b6c8e42..0aee0f71 100644 --- a/lib/ace/css/editor.css +++ b/lib/ace/css/editor.css @@ -2,6 +2,8 @@ position: relative; overflow: hidden; font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace; + font-size: 12px; + line-height: normal; } .ace_scroller { diff --git a/lib/ace/editor.js b/lib/ace/editor.js index cbd0ef71..d7a56fb2 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -342,6 +342,8 @@ var Editor = function(renderer, session) { * **/ this.setFontSize = function(size) { + if (typeof size == "number") + size = size + "px"; this.container.style.fontSize = size; this.renderer.updateFontSize(); }; diff --git a/lib/ace/ext/textarea.js b/lib/ace/ext/textarea.js index a36db850..fe5066b0 100644 --- a/lib/ace/ext/textarea.js +++ b/lib/ace/ext/textarea.js @@ -177,7 +177,8 @@ exports.transformTextarea = function(element, loader) { left: "0px", right: "0px", bottom: "0px", - border: "1px solid gray" + border: "1px solid gray", + position: "absolute" }); container.appendChild(editorDiv); @@ -198,7 +199,7 @@ exports.transformTextarea = function(element, loader) { var settingDiv = document.createElement("div"); var settingDivStyles = { top: "0px", - left: "0px", + left: "20%", right: "0px", bottom: "0px", position: "absolute", @@ -207,7 +208,8 @@ exports.transformTextarea = function(element, loader) { color: "white", display: "none", overflow: "auto", - fontSize: "14px" + fontSize: "14px", + boxShadow: "-5px 2px 3px gray" }; if (!UA.isOldIE) { settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)"; @@ -228,7 +230,7 @@ exports.transformTextarea = function(element, loader) { editor.focus(); // Add the settingPanel opener to the editor's div. - editorDiv.appendChild(settingOpener); + container.appendChild(settingOpener); // Create the API. setupApi(editor, editorDiv, settingDiv, ace, options, loader); @@ -280,13 +282,22 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) { loader = loader || load; function toBool(value) { - return value == "true"; + return value === "true" || value == true; } editor.setDisplaySettings = function(display) { if (display == null) display = settingDiv.style.display == "none"; - settingDiv.style.display = display ? "block" : "none"; + if (display) { + settingDiv.style.display = "block"; + settingDiv.hideButton.focus(); + editor.on("focus", function onFocus() { + editor.removeListener("focus", onFocus); + settingDiv.style.display = "none" + }); + } else { + editor.focus(); + }; }; editor.setOption = function(key, value) { @@ -393,10 +404,7 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) { } function setupSettingPanel(settingDiv, settingOpener, editor, options) { - var BOOL = { - "true": true, - "false": false - }; + var BOOL = null; var desc = { mode: "Mode:", @@ -484,6 +492,14 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) { table.push(""); function renderOption(builder, option, obj, cValue) { + if (!obj) { + builder.push( + "" + ); + return + } builder.push("
SettingValue