Merge pull request #1234 from ajaxorg/hotfix/ie
Hotfix ie and bookmarklet
This commit is contained in:
commit
1bcfc979dd
8 changed files with 51 additions and 25 deletions
|
|
@ -441,7 +441,7 @@ var buildAce = function(options) {
|
||||||
if (options.shrinkwrap) {
|
if (options.shrinkwrap) {
|
||||||
console.log('# combining files into one ---------');
|
console.log('# combining files into one ---------');
|
||||||
copy({
|
copy({
|
||||||
source: { root:targetDir, exclude:/^worker\-/ },
|
source: { root:targetDir, exclude:/(^|\\|\/)worker\-[^\\\/]*\.js$/ },
|
||||||
dest: BUILD_DIR + '/ace-min.js'
|
dest: BUILD_DIR + '/ace-min.js'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ inject(function () {
|
||||||
var ace = window.__ace_shadowed__;
|
var ace = window.__ace_shadowed__;
|
||||||
var t = document.querySelector("textarea");
|
var t = document.querySelector("textarea");
|
||||||
textAce = ace.transformTextarea(t, window.__ace_loader__);
|
textAce = ace.transformTextarea(t, window.__ace_loader__);
|
||||||
textAce.setDisplaySettings(true);
|
setTimeout(function(){textAce.setDisplaySettings(true)});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ace_scroller {
|
.ace_scroller {
|
||||||
|
|
|
||||||
|
|
@ -342,6 +342,8 @@ var Editor = function(renderer, session) {
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
this.setFontSize = function(size) {
|
this.setFontSize = function(size) {
|
||||||
|
if (typeof size == "number")
|
||||||
|
size = size + "px";
|
||||||
this.container.style.fontSize = size;
|
this.container.style.fontSize = size;
|
||||||
this.renderer.updateFontSize();
|
this.renderer.updateFontSize();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,8 @@ exports.transformTextarea = function(element, loader) {
|
||||||
left: "0px",
|
left: "0px",
|
||||||
right: "0px",
|
right: "0px",
|
||||||
bottom: "0px",
|
bottom: "0px",
|
||||||
border: "1px solid gray"
|
border: "1px solid gray",
|
||||||
|
position: "absolute"
|
||||||
});
|
});
|
||||||
container.appendChild(editorDiv);
|
container.appendChild(editorDiv);
|
||||||
|
|
||||||
|
|
@ -198,7 +199,7 @@ exports.transformTextarea = function(element, loader) {
|
||||||
var settingDiv = document.createElement("div");
|
var settingDiv = document.createElement("div");
|
||||||
var settingDivStyles = {
|
var settingDivStyles = {
|
||||||
top: "0px",
|
top: "0px",
|
||||||
left: "0px",
|
left: "20%",
|
||||||
right: "0px",
|
right: "0px",
|
||||||
bottom: "0px",
|
bottom: "0px",
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
|
|
@ -207,7 +208,8 @@ exports.transformTextarea = function(element, loader) {
|
||||||
color: "white",
|
color: "white",
|
||||||
display: "none",
|
display: "none",
|
||||||
overflow: "auto",
|
overflow: "auto",
|
||||||
fontSize: "14px"
|
fontSize: "14px",
|
||||||
|
boxShadow: "-5px 2px 3px gray"
|
||||||
};
|
};
|
||||||
if (!UA.isOldIE) {
|
if (!UA.isOldIE) {
|
||||||
settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
|
settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
|
||||||
|
|
@ -228,7 +230,7 @@ exports.transformTextarea = function(element, loader) {
|
||||||
editor.focus();
|
editor.focus();
|
||||||
|
|
||||||
// Add the settingPanel opener to the editor's div.
|
// Add the settingPanel opener to the editor's div.
|
||||||
editorDiv.appendChild(settingOpener);
|
container.appendChild(settingOpener);
|
||||||
|
|
||||||
// Create the API.
|
// Create the API.
|
||||||
setupApi(editor, editorDiv, settingDiv, ace, options, loader);
|
setupApi(editor, editorDiv, settingDiv, ace, options, loader);
|
||||||
|
|
@ -280,13 +282,22 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
|
||||||
loader = loader || load;
|
loader = loader || load;
|
||||||
|
|
||||||
function toBool(value) {
|
function toBool(value) {
|
||||||
return value == "true";
|
return value === "true" || value == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.setDisplaySettings = function(display) {
|
editor.setDisplaySettings = function(display) {
|
||||||
if (display == null)
|
if (display == null)
|
||||||
display = settingDiv.style.display == "none";
|
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) {
|
editor.setOption = function(key, value) {
|
||||||
|
|
@ -393,10 +404,7 @@ function setupApi(editor, editorDiv, settingDiv, ace, options, loader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
||||||
var BOOL = {
|
var BOOL = null;
|
||||||
"true": true,
|
|
||||||
"false": false
|
|
||||||
};
|
|
||||||
|
|
||||||
var desc = {
|
var desc = {
|
||||||
mode: "Mode:",
|
mode: "Mode:",
|
||||||
|
|
@ -484,6 +492,14 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
||||||
table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
|
table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
|
||||||
|
|
||||||
function renderOption(builder, option, obj, cValue) {
|
function renderOption(builder, option, obj, cValue) {
|
||||||
|
if (!obj) {
|
||||||
|
builder.push(
|
||||||
|
"<input type='checkbox' title='", option, "' ",
|
||||||
|
cValue == "true" ? "checked='true'" : "",
|
||||||
|
"'></input>"
|
||||||
|
);
|
||||||
|
return
|
||||||
|
}
|
||||||
builder.push("<select title='" + option + "'>");
|
builder.push("<select title='" + option + "'>");
|
||||||
for (var value in obj) {
|
for (var value in obj) {
|
||||||
builder.push("<option value='" + value + "' ");
|
builder.push("<option value='" + value + "' ");
|
||||||
|
|
@ -508,18 +524,21 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
||||||
table.push("</table>");
|
table.push("</table>");
|
||||||
settingDiv.innerHTML = table.join("");
|
settingDiv.innerHTML = table.join("");
|
||||||
|
|
||||||
|
var onChange = function(e) {
|
||||||
|
var select = e.currentTarget;
|
||||||
|
editor.setOption(select.title, select.value);
|
||||||
|
};
|
||||||
|
var onClick = function(e) {
|
||||||
|
var cb = e.currentTarget;
|
||||||
|
editor.setOption(cb.title, cb.checked);
|
||||||
|
};
|
||||||
var selects = settingDiv.getElementsByTagName("select");
|
var selects = settingDiv.getElementsByTagName("select");
|
||||||
for (var i = 0; i < selects.length; i++) {
|
for (var i = 0; i < selects.length; i++)
|
||||||
var onChange = (function() {
|
|
||||||
var select = selects[i];
|
|
||||||
return function() {
|
|
||||||
var option = select.title;
|
|
||||||
var value = select.value;
|
|
||||||
editor.setOption(option, value);
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
selects[i].onchange = onChange;
|
selects[i].onchange = onChange;
|
||||||
}
|
var cbs = settingDiv.getElementsByTagName("input");
|
||||||
|
for (var i = 0; i < cbs.length; i++)
|
||||||
|
cbs[i].onclick = onClick;
|
||||||
|
|
||||||
|
|
||||||
var button = document.createElement("input");
|
var button = document.createElement("input");
|
||||||
button.type = "button";
|
button.type = "button";
|
||||||
|
|
@ -528,6 +547,7 @@ function setupSettingPanel(settingDiv, settingOpener, editor, options) {
|
||||||
editor.setDisplaySettings(false);
|
editor.setDisplaySettings(false);
|
||||||
});
|
});
|
||||||
settingDiv.appendChild(button);
|
settingDiv.appendChild(button);
|
||||||
|
settingDiv.hideButton = button;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default startup options.
|
// Default startup options.
|
||||||
|
|
@ -540,7 +560,7 @@ exports.options = {
|
||||||
keybindings: "ace",
|
keybindings: "ace",
|
||||||
showPrintMargin: "false",
|
showPrintMargin: "false",
|
||||||
useSoftTabs: "true",
|
useSoftTabs: "true",
|
||||||
showInvisibles: "true"
|
showInvisibles: "false"
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ var TextInput = function(parentNode, host) {
|
||||||
text.autocapitalize = "off";
|
text.autocapitalize = "off";
|
||||||
text.spellcheck = false;
|
text.spellcheck = false;
|
||||||
|
|
||||||
text.style.bottom = "-2em";
|
text.style.bottom = "2000em";
|
||||||
parentNode.insertBefore(text, parentNode.firstChild);
|
parentNode.insertBefore(text, parentNode.firstChild);
|
||||||
|
|
||||||
var PLACEHOLDER = "\x01\x01";
|
var PLACEHOLDER = "\x01\x01";
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ function GutterHandler(mouseHandler) {
|
||||||
return;
|
return;
|
||||||
var gutterRegion = gutter.getRegion(e);
|
var gutterRegion = gutter.getRegion(e);
|
||||||
|
|
||||||
if (gutterRegion)
|
if (gutterRegion == "foldWidgets")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var row = e.getDocumentPosition().row;
|
var row = e.getDocumentPosition().row;
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ function FoldHandler(editor) {
|
||||||
});
|
});
|
||||||
|
|
||||||
editor.on("guttermousedown", function(e) {
|
editor.on("guttermousedown", function(e) {
|
||||||
|
if (!editor.isFocused())
|
||||||
|
return;
|
||||||
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
var gutterRegion = editor.renderer.$gutterLayer.getRegion(e);
|
||||||
|
|
||||||
if (gutterRegion == "foldWidgets") {
|
if (gutterRegion == "foldWidgets") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue