树节点初始化状态 bug 修改
This commit is contained in:
parent
2f0643c940
commit
2252a50979
|
@ -175,6 +175,10 @@
|
||||||
$.dialog._close(id, settings);
|
$.dialog._close(id, settings);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(window).resize(function () {
|
||||||
|
$(".dialog-background").height($("body").height());
|
||||||
|
});
|
||||||
|
|
||||||
if (typeof settings.afterInit === "function") {
|
if (typeof settings.afterInit === "function") {
|
||||||
settings.afterInit();
|
settings.afterInit();
|
||||||
|
@ -232,7 +236,7 @@
|
||||||
_document.ondragstart = null;
|
_document.ondragstart = null;
|
||||||
_document.onselectstart = null;
|
_document.onselectstart = null;
|
||||||
_document.onselect = null;
|
_document.onselect = null;
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
_close: function (id, settings) {
|
_close: function (id, settings) {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var session = {
|
var session = {
|
||||||
init: function () {
|
init: function () {
|
||||||
|
@ -63,7 +63,20 @@ var session = {
|
||||||
// expand tree
|
// expand tree
|
||||||
for (var j = 0, jj = fileTree.length; j < jj; j++) {
|
for (var j = 0, jj = fileTree.length; j < jj; j++) {
|
||||||
if (nodes[i].path === fileTree[j]) {
|
if (nodes[i].path === fileTree[j]) {
|
||||||
tree.fileTree.expandNode(nodes[i], true, false, true);
|
// 当父节点都展开时,才展开该节点
|
||||||
|
var parents = tree.getAllParents(tree.fileTree.getNodeByTId(nodes[i].tId)),
|
||||||
|
isOpen = true;
|
||||||
|
for (var l = 0, max = parents.length; l < max; l++) {
|
||||||
|
if (parents[l].open === false) {
|
||||||
|
isOpen = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isOpen) {
|
||||||
|
tree.fileTree.expandNode(nodes[i], true, false, true);
|
||||||
|
} else {
|
||||||
|
// 设置状态
|
||||||
|
nodes[i].open = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +91,7 @@ var session = {
|
||||||
|
|
||||||
if (nodes[i].path === currentFile) {
|
if (nodes[i].path === currentFile) {
|
||||||
id = nodes[i].tId;
|
id = nodes[i].tId;
|
||||||
|
|
||||||
// FIXME: 上面的展开是异步进行的,所以执行到这里的时候可能还没有展开完,导致定位不了可视区域
|
// FIXME: 上面的展开是异步进行的,所以执行到这里的时候可能还没有展开完,导致定位不了可视区域
|
||||||
tree.fileTree.selectNode(nodes[i]);
|
tree.fileTree.selectNode(nodes[i]);
|
||||||
wide.curNode = nodes[i];
|
wide.curNode = nodes[i];
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var tree = {
|
var tree = {
|
||||||
fileTree: undefined,
|
fileTree: undefined,
|
||||||
|
@ -77,7 +77,19 @@ var tree = {
|
||||||
|
|
||||||
return paths;
|
return paths;
|
||||||
},
|
},
|
||||||
_isParents: function (tId, parentTId) {
|
getAllParents: function (node, parents) {
|
||||||
|
if (!parents) {
|
||||||
|
parents = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!node || !node.parentTId) {
|
||||||
|
return parents;
|
||||||
|
} else {
|
||||||
|
parents.push(node.getParentNode());
|
||||||
|
return tree.getAllParents(node.getParentNode(), parents);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isParents: function (tId, parentTId) {
|
||||||
var node = tree.fileTree.getNodeByTId(tId);
|
var node = tree.fileTree.getNodeByTId(tId);
|
||||||
if (!node || !node.parentTId) {
|
if (!node || !node.parentTId) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -85,7 +97,7 @@ var tree = {
|
||||||
if (node.parentTId === parentTId) {
|
if (node.parentTId === parentTId) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return tree._isParents(node.parentTId, parentTId);
|
return tree.isParents(node.parentTId, parentTId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -86,7 +86,7 @@ var wide = {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
for (var i = 0, ii = editors.data.length; i < ii; i++) {
|
||||||
if (tree._isParents(editors.data[i].id, wide.curNode.tId)) {
|
if (tree.isParents(editors.data[i].id, wide.curNode.tId)) {
|
||||||
$(".edit-panel .tabs > div[data-index=" + editors.data[i].id + "]").find(".ico-close").click();
|
$(".edit-panel .tabs > div[data-index=" + editors.data[i].id + "]").find(".ico-close").click();
|
||||||
i--;
|
i--;
|
||||||
ii--;
|
ii--;
|
||||||
|
|
Loading…
Reference in New Issue