Commit 0bcbb851 authored by Ronny's avatar Ronny

修bug,删除根节点操作导致报错,修改方法,根节点不能删除,直接return

同时几处调用之前先检测变量
parent 8d6d33e3
// 选区管理
kity.extendClass( Minder, function () {
function highlightNode( km, node ) {
node.setTmpData( "highlight", true );
km.highlightNode( node );
if( node ){
node.setTmpData( "highlight", true );
km.highlightNode( node );
}
}
function unhighlightNode( km, node ) {
node.setTmpData( "highlight", false );
km.highlightNode( node );
if( node ){
node.setTmpData( "highlight", false );
km.highlightNode( node );
}
}
return {
_initSelection: function () {
......
......@@ -30,7 +30,7 @@ KityMinder.registerModule( "basestylemodule", function () {
return -1;
}
utils.each(nodes,function(i,n){
if(n.getData('bold')){
if( n && n.getData('bold') ){
result = 1;
return false;
}
......@@ -65,7 +65,7 @@ KityMinder.registerModule( "basestylemodule", function () {
return -1;
}
utils.each(nodes,function(i,n){
if(n.getData('italic')){
if( n && n.getData('italic') ){
result = 1;
return false;
}
......
......@@ -162,6 +162,11 @@ KityMinder.registerModule( "LayoutModule", function () {
return {
base: Command,
execute: function ( km ) {
if( km.getRoot().children.length == 0 ){
return;
}
var selectedNodes = km.getSelectedNodes();
var _root = km.getRoot();
var _buffer = [];
......
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