mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-21 02:29:23 +00:00
feature(edward) setUseOfWorker
This commit is contained in:
parent
ece8637275
commit
7e1b537b0e
2 changed files with 16 additions and 24 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue