Merge pull request #2096 from ajaxorg/old-worker
Allow using uiWorker on ie9 where Worker is undefined
This commit is contained in:
commit
df58b5b710
3 changed files with 11 additions and 10 deletions
|
|
@ -107,6 +107,7 @@ exports.edit = function(el) {
|
||||||
event.addListener(window, "resize", env.onResize);
|
event.addListener(window, "resize", env.onResize);
|
||||||
editor.on("destroy", function() {
|
editor.on("destroy", function() {
|
||||||
event.removeListener(window, "resize", env.onResize);
|
event.removeListener(window, "resize", env.onResize);
|
||||||
|
env.editor.container.env = null; // prevent memory leak on old ie
|
||||||
});
|
});
|
||||||
editor.container.env = editor.env = env;
|
editor.container.env = editor.env = env;
|
||||||
return editor;
|
return editor;
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,10 @@ exports.moduleUrl = function(name, component) {
|
||||||
// todo make this configurable or get rid of '-'
|
// todo make this configurable or get rid of '-'
|
||||||
var sep = component == "snippets" ? "/" : "-";
|
var sep = component == "snippets" ? "/" : "-";
|
||||||
var base = parts[parts.length - 1];
|
var base = parts[parts.length - 1];
|
||||||
|
if (component == "worker" && sep == "-") {
|
||||||
|
var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g");
|
||||||
|
base = base.replace(re, "");
|
||||||
|
}
|
||||||
|
|
||||||
if ((!base || base == component) && parts.length > 1)
|
if ((!base || base == component) && parts.length > 1)
|
||||||
base = parts[parts.length - 2];
|
base = parts[parts.length - 2];
|
||||||
|
|
|
||||||
|
|
@ -966,17 +966,13 @@ var EditSession = function(text, mode) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$startWorker = function() {
|
this.$startWorker = function() {
|
||||||
if (typeof Worker !== "undefined" && !require.noWorker) {
|
try {
|
||||||
try {
|
this.$worker = this.$mode.createWorker(this);
|
||||||
this.$worker = this.$mode.createWorker(this);
|
} catch (e) {
|
||||||
} catch (e) {
|
console.log("Could not load worker");
|
||||||
console.log("Could not load worker");
|
console.log(e);
|
||||||
console.log(e);
|
|
||||||
this.$worker = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
this.$worker = null;
|
this.$worker = null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue