diff --git a/static/js/editors.js b/static/js/editors.js index f59ea4b..fc1df44 100644 --- a/static/js/editors.js +++ b/static/js/editors.js @@ -538,6 +538,7 @@ var editors = { theme: 'wide', indentUnit: 4, foldGutter: true, + path: data.path, extraKeys: { "Ctrl-\\": "autocompleteAnyWord", ".": "autocompleteAfterDot", @@ -589,10 +590,20 @@ var editors = { editor.on('changes', function (cm) { if (cm.doc.isClean()) { // 没有修改过 - $(".edit-panel .tabs > div.current > span").removeClass("changed"); + $(".edit-panel .tabs > div").each(function () { + var $span = $(this).find("span:eq(0)"); + if ($span.attr("title") === cm.options.path) { + $span.removeClass("changed"); + } + }); } else { // 修改过 - $(".edit-panel .tabs > div.current > span").addClass("changed"); + $(".edit-panel .tabs > div").each(function () { + var $span = $(this).find("span:eq(0)"); + if ($span.attr("title") === cm.options.path) { + $span.addClass("changed"); + } + }); } }); diff --git a/static/js/session.js b/static/js/session.js index b12ac1e..5a4131c 100644 --- a/static/js/session.js +++ b/static/js/session.js @@ -47,7 +47,7 @@ var session = { // expand tree for (var j = 0, jj = fileTree.length; j < jj; j++) { if (nodes[i].path === fileTree[j]) { - tree.fileTree.expandNode(nodes[i], true, false, false); + tree.fileTree.expandNode(nodes[i], true, false, true); break; } } @@ -62,6 +62,10 @@ var session = { if (nodes[i].path === currentFile) { id = nodes[i].tId; + + // FIXME: 上面的展开是异步进行的,所以执行到这里的时候可能还没有展开完,导致定位不了可视区域 + tree.fileTree.selectNode(nodes[i]); + wide.curNode = nodes[i]; } }