From 7e1b537b0ee3ed971b53e670fec21903c9d0e52a Mon Sep 17 00:00:00 2001 From: coderaiser Date: Tue, 13 Jan 2015 09:20:39 -0500 Subject: [PATCH] feature(edward) setUseOfWorker --- lib/client/edit.js | 15 +-------------- lib/client/edward.js | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/lib/client/edit.js b/lib/client/edit.js index 69f18e70..91d7a92d 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -197,7 +197,7 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, MenuIO, Format, edward; isJS = mode === jsMode; session.setMode(mode, function() { - setUseOfWorker(mode); + edward.setUseOfWorker(mode); if (isHTML) setEmmet(); @@ -257,19 +257,6 @@ var CloudCmd, Util, DOM, CloudFunc, io, ace, Zip, MenuIO, Format, edward; }); } - function setUseOfWorker(mode) { - var isMatch, - session = edward.getSession(), - isStr = typeof mode === 'string', - regStr = 'coffee|css|html|javascript|json|lua|php|xquery', - regExp = new RegExp(regStr); - - if (isStr) - isMatch = regExp.test(mode); - - session.setUseWorker(isMatch); - } - this.create = function(element) { Element = element; diff --git a/lib/client/edward.js b/lib/client/edward.js index 3b8bf9b2..8431d8d0 100644 --- a/lib/client/edward.js +++ b/lib/client/edward.js @@ -94,14 +94,27 @@ var join, ace, Util, DOM; session.setUndoManager(new UndoManager()); }; - edward.setOption = function(name, value) { + edward.setOption = function(name, value) { Ace.setOption(name, value); }; - edward.setOptions = function(options) { + edward.setOptions = function(options) { Ace.setOptions(options); }; + edward.setUseOfWorker = function(mode) { + var isMatch, + session = edward.getSession(), + isStr = typeof mode === 'string', + regStr = 'coffee|css|html|javascript|json|lua|php|xquery', + regExp = new RegExp(regStr); + + if (isStr) + isMatch = regExp.test(mode); + + session.setUseWorker(isMatch); + }; + edward.selectAll = function() { Ace.selectAll(); }; @@ -118,14 +131,6 @@ var join, ace, Util, DOM; edward.showMessage = function(text) { var HIDE_TIME = 2000; - /* - * Msg should be created and removed - * if it's not and just inner text - * is changing, when hide and show of DOM - * is called - bug occures: empty box - * with no text inside. - */ - if (!ElementMsg) { ElementMsg = createMsg(); Element.appendChild(ElementMsg);