diff --git a/lib/client/edit.js b/lib/client/edit.js index e183d90c..9654dae0 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -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();