This commit is contained in:
Van 2015-04-10 20:03:07 +08:00
parent f573841b59
commit 9bc8addfbf
1 changed files with 12 additions and 5 deletions

View File

@ -510,20 +510,27 @@ var tree = {
$("#dialogRenamePrompt").dialog("close"); $("#dialogRenamePrompt").dialog("close");
// update tree node // update tree node
var suffixIndex = name.lastIndexOf('.'), var suffixIndex = name.lastIndexOf('.');
iconSkin = wide.getClassBySuffix(name.substr(suffixIndex + 1)); var suffix = name.substr(suffixIndex + 1);
var iconSkin = 'ico-ztree-dir ';
if ('f' === wide.curNode.type) {
iconSkin = wide.getClassBySuffix(suffix);
}
wide.curNode.name = name; wide.curNode.name = name;
wide.curNode.title = request.newPath; wide.curNode.title = request.newPath;
wide.curNode.path = request.newPath; wide.curNode.path = request.newPath;
wide.curNode.iconSkin = iconSkin; wide.curNode.iconSkin = iconSkin;
tree.fileTree.updateNode(wide.curNode); tree.fileTree.updateNode(wide.curNode);
// update open editor tab name // update open editor tab name
for (var i = 0, ii = editors.data.length; i < ii; i++) { for (var i = 0, ii = editors.data.length; i < ii; i++) {
if (wide.curNode.tId === editors.data[i].id) { if (wide.curNode.tId === editors.data[i].id) {
var info = CodeMirror.findModeByExtension(name.substr(suffixIndex + 1)); var mode = CodeMirror.findModeByExtension(suffix);
if (info) { if (mode) {
editors.data[i].editor.setOption("mode", info.mime); editors.data[i].editor.setOption("mode", mode.mime);
} }
var $currentSpan = $(".edit-panel .tabs > div[data-index=" + wide.curNode.tId + "] > span:eq(0)"); var $currentSpan = $(".edit-panel .tabs > div[data-index=" + wide.curNode.tId + "] > span:eq(0)");