diff --git a/doc/site/js/main.js b/doc/site/js/main.js index 78595c6a..e6cd609c 100644 --- a/doc/site/js/main.js +++ b/doc/site/js/main.js @@ -161,7 +161,12 @@ function highlight() { var highlighter = ace.require("ace/ext/static_highlight") var dom = ace.require("ace/lib/dom") function qsa(sel) { - return [].slice.call(document.querySelectorAll(sel)); + var items = document.querySelectorAll(sel); + var result = []; + for (var i = 0; i < items.length; i++) { + result.push(items[i]); + } + return result; } qsa("code[class]").forEach(function(el) { diff --git a/index.html b/index.html index 8d65f8ea..9c416582 100644 --- a/index.html +++ b/index.html @@ -11,6 +11,9 @@ +
@@ -65,7 +68,7 @@ and is the successor of the Mozilla Skywriter (Bespin) project. -/**
* In fact, you're looking at ACE right now. Go ahead and play with it!
*
* We are currently showing off the JavaScript mode. ACE has support for 45
@@ -80,7 +83,7 @@ function add(x, y) {
var addResult = add(3, 2);
console.log(addResult);
-Learn how to embed this in your own site
Looking for a more full-featured demo? Check out the kitchen sink. @@ -140,7 +143,7 @@ console.log(addResult);
Ace can be easily embedded into a web page. Get prebuilt version of ace from ace-builds repository and use the code below:
-<!DOCTYPE html>
<html lang="en">
<head>
<title>ACE in Action</title>
@@ -168,7 +171,7 @@ console.log(addResult);
editor.getSession().setMode("ace/mode/javascript");
</script>
</body>
-</html>Now check out the How-To Guide for instructions on common operations, such as setting a different language mode or getting the contents from the editor. diff --git a/lib/ace/ext/old_ie.js b/lib/ace/ext/old_ie.js index ca67888f..ce3f4e72 100644 --- a/lib/ace/ext/old_ie.js +++ b/lib/ace/ext/old_ie.js @@ -103,6 +103,12 @@ patch( }" ); +patch( + require("ace/mode/text").Mode.prototype, "getTokenizer", + /Tokenizer/, + "TokenizerModule.Tokenizer" +); + useragent.isOldIE = true; }); diff --git a/lib/ace/ext/themelist.js b/lib/ace/ext/themelist.js index 9eb4b71e..8914c776 100644 --- a/lib/ace/ext/themelist.js +++ b/lib/ace/ext/themelist.js @@ -41,6 +41,7 @@ define(function(require, exports, module) { "use strict"; +require("ace/lib/fixoldbrowsers"); var themeData = [ ["Chrome" ], diff --git a/lib/ace/layer/font_metrics.js b/lib/ace/layer/font_metrics.js index 45fa44cb..a65e100d 100644 --- a/lib/ace/layer/font_metrics.js +++ b/lib/ace/layer/font_metrics.js @@ -54,7 +54,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) { if (!CHAR_COUNT) this.$testFractionalRect(); - this.$measureNode.textContent = lang.stringRepeat("X", CHAR_COUNT); + this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT); this.$characterSize = {width: 0, height: 0}; this.checkForSizeChanges(); @@ -121,11 +121,18 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) { }; this.$measureSizes = function() { - var rect = this.$measureNode.getBoundingClientRect(); - var size = { - height: rect.height, - width: rect.width / CHAR_COUNT - }; + if (CHAR_COUNT === 1) { + var rect = this.$measureNode.getBoundingClientRect(); + var size = { + height: rect.height, + width: rect.width + }; + } else { + var size = { + height: this.$measureNode.clientHeight, + width: this.$measureNode.clientWidth / CHAR_COUNT + }; + } // Size and width can be null if the editor is not visible or // detached from the document if (size.width === 0 || size.height === 0) @@ -134,7 +141,7 @@ var FontMetrics = exports.FontMetrics = function(parentEl, interval) { }; this.$measureCharWidth = function(ch) { - this.$main.textContent = lang.stringRepeat(ch, CHAR_COUNT); + this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT); var rect = this.$main.getBoundingClientRect(); return rect.width / CHAR_COUNT; };