async file

This commit is contained in:
Van 2015-09-27 11:02:48 +08:00
parent a119370a23
commit f4693a6eee
2 changed files with 35 additions and 3 deletions

View File

@ -13,7 +13,7 @@
"Keymap": "wide", "Keymap": "wide",
"Created": 1414080000000000000, "Created": 1414080000000000000,
"Updated": 1414080000000000000, "Updated": 1414080000000000000,
"Lived": 1414080000000000000, "Lived": 1443322949749873692,
"Editor": { "Editor": {
"FontFamily": "Consolas, 'Courier New', monospace", "FontFamily": "Consolas, 'Courier New', monospace",
"FontSize": "13px", "FontSize": "13px",
@ -22,8 +22,12 @@
"TabSize": "4" "TabSize": "4"
}, },
"LatestSessionContent": { "LatestSessionContent": {
"FileTree": [], "FileTree": [
"Files": [], "/Users/Vanessa/Work/GoGoGo/src"
],
"Files": [
"/Users/Vanessa/Work/GoGoGo/src/1.css"
],
"CurrentFile": "", "CurrentFile": "",
"FileTreeLayout": null, "FileTreeLayout": null,
"EditorLayout": null, "EditorLayout": null,

View File

@ -165,8 +165,36 @@ var session = {
switch (data.cmd) { switch (data.cmd) {
case 'create-file': case 'create-file':
var dirNode = tree.fileTree.getNodeByTId(tree.getTIdByPath(data.dir)),
name = data.path.replace(data.dir + '/', ''),
mode = CodeMirror.findModeByFileName(name),
iconSkin = wide.getClassBySuffix(name.split(".")[1]);
if (data.type && data.type === 'file') {
tree.fileTree.addNodes(dirNode, [{
"name": name,
"iconSkin": iconSkin,
"path": data.path,
"mode": mode,
"removable": true,
"creatable": true
}]);
} else {
tree.fileTree.addNodes(dirNode, [{
"name": name,
"iconSkin": "ico-ztree-dir ",
"path": data.path,
"removable": true,
"creatable": true,
"isParent": true
}]);
}
break; break;
case 'remove-file': case 'remove-file':
var dirNode = tree.fileTree.getNodeByTId(tree.getTIdByPath(data.dir));
tree.fileTree.removeNode(dirNode);
break; break;
} }
}; };