restore ie8 compatibility

This commit is contained in:
nightwing 2014-03-11 18:30:20 +04:00
commit 051128c16f
5 changed files with 34 additions and 12 deletions

View file

@ -103,6 +103,12 @@ patch(
}"
);
patch(
require("ace/mode/text").Mode.prototype, "getTokenizer",
/Tokenizer/,
"TokenizerModule.Tokenizer"
);
useragent.isOldIE = true;
});

View file

@ -41,6 +41,7 @@
define(function(require, exports, module) {
"use strict";
require("ace/lib/fixoldbrowsers");
var themeData = [
["Chrome" ],

View file

@ -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;
};