Commit 318eac64 authored by campaign's avatar campaign

右键添加插入节点菜单

parent 09a3fa39
# KityMinder 更新日志
## v1.3.0
### 体验优化
1. 当在空白处右键时,在菜单项中添加插入节点选项
### BUG修复
1. 修复在空白节点有时会出现a字符的问题
## v1.2.1
### 体验优化
......
......@@ -14,6 +14,10 @@ KityMinder.LANG['zh-cn'] = {
'fresh-purple': '浪漫紫',
'fresh-pink': '脑残粉'
},
'insert':{
//'maintopic':'插入中心主题',
'topic':'插入分支主题'
},
'maintopic': '中心主题',
'topic': '分支主题',
'tooltips': {
......
......@@ -18,7 +18,7 @@ KM.registerUI( 'contextmenu', function () {
if(item.exec){
item.exec.apply(km)
item.exec.apply(me);
}else{
me.execCommand(item.cmdName);
}
......@@ -50,11 +50,19 @@ KM.registerUI( 'contextmenu', function () {
data.length && data.push(item);
return;
}
if(item.query){
if(item.query.apply(me) != -1)
data.push({
label:item.label,
value:item.cmdName
});
return;
}
if(me.queryCommandState(item.cmdName)!=-1){
data.push({
label:item.label,
value:item.cmdName
})
});
}
});
if(data.length){
......@@ -79,6 +87,6 @@ KM.registerUI( 'contextmenu', function () {
if(e.isRightMB()){
//e.stopPropagationImmediately();
}
})
});
} );
......@@ -111,6 +111,16 @@ KityMinder.registerModule('NodeModule', function() {
cmdName: 'RemoveNode'
}, {
divider: 1
},{
label: this.getLang('insert.topic'),
exec: function() {
this.select(this.getRoot());
this.execCommand('AppendSiblingNode', this.getLang('topic'));
},
query:function(){
var nodes = this.getSelectedNodes();
return nodes.length === 0 ? 0 : -1;
}
}]
};
});
\ No newline at end of file
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