feature(dword) add

This commit is contained in:
coderaiser 2015-02-24 07:31:42 -05:00
parent 01656051e2
commit 0603393a52
4 changed files with 46 additions and 13 deletions

View file

@ -12,6 +12,7 @@
"online": true,
"cache": true,
"showKeysPanel": true,
"editor": "dword",
"port": 8000,
"ip": null
}

View file

@ -15,6 +15,8 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
Menu,
Editor = 'edward',
Images = DOM.Images,
MSG_CHANGED,
Element,
@ -38,6 +40,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
exec.series([
CloudCmd.View,
getConfig,
function(callback) {
loadFiles(element, callback);
},
@ -70,21 +73,24 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
ConfigView.beforeShow = callback;
Info.getData(function(error, data) {
var isDir = Info.isDir,
name = Info.name,
path = Info.path;
var path = Info.path;
if (error) {
alert(error);
} else {
edward.once('change', function() {
var isDir = Info.isDir,
name = Info.name;
if (isDir)
edward.setMode('json');
else
edward.setModeForPath(name);
CloudCmd.View.show(Element, ConfigView);
});
edward.setValueFirst(path, data);
if (isDir)
edward.setMode('json');
else
edward.setModeForPath(name);
CloudCmd.View.show(Element, ConfigView);
}
});
@ -154,8 +160,19 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
return this;
};
function getConfig(callback) {
DOM.Files.get('config', function(error, config) {
if (error)
alert(error);
else if (config.editor)
Editor = config.editor;
callback();
});
}
function loadFiles(element, callback) {
var url = '/edward/edward.js';
var url = '/' + Editor + '/' + Editor + '.js';
Util.time(Name + ' load');
@ -166,6 +183,8 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward;
Loading = false;
edward = window[Editor];
edward(element, options, function() {
Util.timeEnd(Name + ' load');
exec(callback);

View file

@ -19,8 +19,9 @@
restafary = require('restafary'),
webconsole = require('console-io'),
edward = require('edward'),
dword = require('dword'),
emptyFunc = function(req, res, next) {
emptyFunc = function(req, res, next) {
next();
};
@ -61,6 +62,10 @@
edward.listen(socket, {
size: size
});
dword.listen(socket, {
size: size
});
};
function cloudcmd() {
@ -105,7 +110,14 @@
diff : isDiff,
zip : isZip
}),
dword({
minify : isMinify,
online : isOnline,
diff : isDiff,
zip : isZip
}),
mollify({
dir : DIR_ROOT,
is : isMinify

View file

@ -29,6 +29,7 @@
"ashify": "~1.0.0",
"console-io": "~2.2.0",
"copymitter": "~1.5.0",
"dword": "~1.1.2",
"edward": "~1.3.0",
"execon": "~1.1.0",
"express": "~4.12.0",