Commit d53af815 authored by campaign's avatar campaign

Merge remote-tracking branch 'origin/dev' into dev

parents f3bccfde 70fc3260
......@@ -25,10 +25,23 @@
initEvent: function ( km, $w ) {
$w.on( "click", "li", function () {
var $this = $( this );
$this.siblings().removeClass( "active" );
$this.toggleClass( "active" );
var val = $this.val();
if ( !$this.hasClass( "active" ) ) {
val = null;
}
var type = $this.attr( "type" );
km.execCommand( type, val );
} );
km.on( 'interactchange', function ( e ) {
var valPri = this.queryCommandValue( "setpriority" );
var valPro = this.queryCommandValue( "setprogress" );
$w.find( "li[type='setpriority']" ).removeClass( "active" );
$w.find( "li[type='setpriority'][value='" + valPri + "']" ).addClass( "active" );
$w.find( "li[type='setprogress']" ).removeClass( "active" );
$w.find( "li[type='setprogress'][value='" + valPro + "']" ).addClass( "active" );
} );
},
buttons: {
'ok': {
......
KityMinder.LANG[ 'zh-cn' ] = {
'maintopic': '中心主题',
'topic': '分支主题',
'tooltips': {
'undo': '撤销',
'redo': '重做',
......
var KityMinder =
window.KM =
window.KityMinder = function(){
window.KityMinder = function () {
var instanceMap = {}, instanceId = 0;
return {
version : '1.0.0',
createMinder : function ( renderTarget, options ) {
version: '1.0.0',
createMinder: function ( renderTarget, options ) {
options = options || {};
options.renderTo = Utils.isString( renderTarget ) ? document.getElementById( renderTarget ) : renderTarget;
var minder = new Minder( options );
this.addMinder(options.renderTo,minder);
this.addMinder( options.renderTo, minder );
return minder;
},
addMinder : function ( target, minder ) {
addMinder: function ( target, minder ) {
var id;
if ( typeof ( target ) === 'string' ) {
id = target;
......@@ -20,17 +20,16 @@ var KityMinder =
}
instanceMap[ id ] = minder;
},
getMinder : function(target,options){
getMinder: function ( target, options ) {
var id;
if ( typeof ( target ) === 'string' ) {
id = target;
} else {
id = target.id || ( "KM_INSTANCE_" + instanceId++ );
}
return instanceMap[ id ] || this.createMinder(target,options);
return instanceMap[ id ] || this.createMinder( target, options );
},
//挂接多语言
LANG:{}
LANG: {}
}
}();
}();
\ No newline at end of file
......@@ -39,7 +39,7 @@ var Minder = KityMinder.Minder = kity.createClass( "KityMinder", {
this._addRenderContainer();
this._root = new MinderNode( "Main Topic" );
this._root = new MinderNode( this.getLang().maintopic );
this._root.setType( "root" );
if ( this._options.renderTo ) {
this.renderTo( this._options.renderTo );
......
......@@ -38,12 +38,12 @@ kity.extendClass( Minder, {
}
}
if(moduleDeals.defaultOptions){
this.setDefaultOptions(moduleDeals.defaultOptions);
if ( moduleDeals.defaultOptions ) {
this.setDefaultOptions( moduleDeals.defaultOptions );
}
//添加模块的快捷键
if(moduleDeals.addShortcutKeys){
this.addShortcutKeys(moduleDeals.addShortcutKeys)
if ( moduleDeals.addShortcutKeys ) {
this.addShortcutKeys( moduleDeals.addShortcutKeys )
}
}
......
......@@ -54,8 +54,13 @@ KityMinder.registerModule( "IconModule", function () {
}
},
queryValue: function ( km ) {
var node = km.getSelectedNode();
return node.getData( "PriorityIcon" );
var nodes = km.getSelectedNodes();
var val;
for ( var i = 0; i < nodes.length; i++ ) {
val = nodes[ i ].getData( "PriorityIcon" );
if ( val ) break;
}
return val;
}
};
} )() );
......@@ -70,8 +75,13 @@ KityMinder.registerModule( "IconModule", function () {
}
},
queryValue: function ( km ) {
var node = km.getSelectedNode();
return node.getData( "ProgressIcon" );
var nodes = km.getSelectedNodes();
var val;
for ( var i = 0; i < nodes.length; i++ ) {
val = nodes[ i ].getData( "ProgressIcon" );
if ( val ) break;
}
return val;
}
};
} )() );
......
......@@ -90,11 +90,11 @@ KityMinder.registerModule( "KeyboardModule", function () {
this.receiver.keydownNode = node;
switch ( e.originEvent.keyCode ) {
case keys.Enter:
this.execCommand( 'appendSiblingNode', new MinderNode( 'Topic' ) );
this.execCommand( 'appendSiblingNode', new MinderNode( this.getLang().topic ) );
e.preventDefault();
break;
case keys.Tab:
this.execCommand( 'appendChildNode', new MinderNode( 'Topic' ) );
this.execCommand( 'appendChildNode', new MinderNode( this.getLang().topic ) );
e.preventDefault();
break;
case keys.Backspace:
......
......@@ -15,7 +15,7 @@
cursor: pointer;
color: #333
}
.icon-list li:hover{
.icon-list li:hover,.icon-list li.active{
background: #cfe0f7
}
.icon-list li span.icon{
......
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