Commit f4caeabb authored by campaign's avatar campaign

by zhanyi

parent 8cf56d08
KityMinder.registerModule( "basestylemodule", function () {
return {
"commands": {
"bold": kity.createClass( "boldCommand", {
base: Command,
execute: function ( km ) {
var nodes = km.getSelectedNodes();
if(this.queryState('bold') == 1){
utils.each(nodes,function(i,n){
n.setData('bold');
n.getTextShape().setAttr('font-weight');
})
}else{
utils.each(nodes,function(i,n){
n.setData('bold',true);
n.getTextShape().setAttr('font-weight','bold');
})
}
},
queryState: function ( km ) {
var nodes = km.getSelectedNodes(),
result = 0;
utils.each(nodes,function(i,n){
if(n.setData('bold')){
result = 1;
return false;
}
});
return result;
}
} ),
"italic": kity.createClass( "italicCommand", {
base: Command,
execute: function ( km ) {
},
queryState: function ( km ) {
}
} )
},
addShortcutKeys: {
"bold": "ctrl+90", //undo
"italic": "ctrl+89" //redo
},
"events": {
"beforerendernode": function ( e ) {
}
}
};
} );
\ No newline at end of file
KityMinder.registerModule( "fontmodule", function () {
return {
"commands": {
"fontcolor": kity.createClass( "fontcolorCommand", {
base: Command,
execute: function ( km,color ) {
var nodes = km.getSelectedNodes();
utils.each(nodes,function(i,n){
n.setData('fontcolor',color);
n.getTextShape().fill(color)
})
}
} ),
"fontfamily": kity.createClass( "fontfamilyCommand", {
base: Command,
execute: function ( km,family) {
var nodes = km.getSelectedNodes();
utils.each(nodes,function(i,n){
n.setData('fontfamily',family);
n.getTextShape().setAttr('font-family',family);
})
}
} )
},
"events": {
"beforerendernode": function ( e ) {
}
}
};
} );
\ 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