Commit 486dccd6 authored by techird's avatar techird

node op bug fix

parent 32d2e267
...@@ -24,7 +24,7 @@ var AppendSiblingCommand = kity.createClass('AppendSiblingCommand', { ...@@ -24,7 +24,7 @@ var AppendSiblingCommand = kity.createClass('AppendSiblingCommand', {
var sibling = km.getSelectedNode(); var sibling = km.getSelectedNode();
var parent = sibling.parent; var parent = sibling.parent;
if (!parent) { if (!parent) {
return null; return km.execCommand('AppendChildNode', text);
} }
var node = km.createNode(text, parent, sibling.getIndex() + 1); var node = km.createNode(text, parent, sibling.getIndex() + 1);
km.select(node, true); km.select(node, true);
...@@ -45,10 +45,10 @@ var RemoveNodeCommand = kity.createClass('RemoverNodeCommand', { ...@@ -45,10 +45,10 @@ var RemoveNodeCommand = kity.createClass('RemoverNodeCommand', {
var ancestor = MinderNode.getCommonAncestor.apply(null, nodes); var ancestor = MinderNode.getCommonAncestor.apply(null, nodes);
nodes.forEach(function(node) { nodes.forEach(function(node) {
km.removeNode(node); if (!node.isRoot()) km.removeNode(node);
}); });
km.select(ancestor, true); km.select(ancestor || km.getRoot(), true);
km.layout(300); km.layout(300);
}, },
queryState: function(km) { queryState: function(km) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment