feature(edit) add setUserOfWorker

This commit is contained in:
coderaiser 2014-04-22 10:31:56 -04:00
parent 655d695907
commit db7075dcd3

View file

@ -81,6 +81,7 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip;
isJS = mode === jsMode;
Session.setMode(mode);
setUseOfWorker(mode);
Util.ifExec(Emmet, function() {
if (Emmet)
@ -141,6 +142,18 @@ var CloudCmd, Util, DOM, CloudFunc, ace, DiffProto, diff_match_patch, Zip;
Ace.gotoLine(number);
};
function setUseOfWorker(mode) {
var isMatch,
isStr = Util.isString(mode),
regStr = 'coffee/css/html/javascript/json/lua/php/xquery',
regExp = new RegExp(regStr);
if (isStr)
isMatch = mode.match(regExp);
Session.setUseWorker(isMatch);
}
function initAce() {
Ace = ace.edit(Element);
Session = Ace.getSession();