Commit 8d6d33e3 authored by Ronny's avatar Ronny

修bug,没有选中节点按enter和tab键报错

parent 78b67651
......@@ -142,6 +142,9 @@ KityMinder.registerModule( "TextEditModule", function () {
if(cmds[e.commandName]){
var node = km.getSelectedNode();
if( !node ){
return;
}
var textShape = node.getTextShape();
......
......@@ -106,6 +106,11 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command,
execute: function ( km, node, focus, silbling ) {
var parent = km.getSelectedNode();
if( !parent ){
return null;
}
if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getData( "expand" ) === false ) {
km.expandNode( parent );
}
......@@ -129,6 +134,9 @@ KityMinder.registerModule( "LayoutModule", function () {
base: Command,
execute: function ( km, node, focus ) {
var selectedNode = km.getSelectedNode();
if( !selectedNode ){
return null;
}
if ( selectedNode.isRoot() ) {
node.setType( "main" );
......
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