From db7075dcd31b8c5a31b628e869b7b21b4db76f0e Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 22 Apr 2014 10:31:56 -0400 Subject: [PATCH] feature(edit) add setUserOfWorker --- lib/client/edit.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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();