Commit 5573c91c authored by campaign's avatar campaign

添加超链接功能

parent f5a98519
......@@ -26,9 +26,9 @@
,'module/layout.default.js'
,'module/layout.bottom.js'
,'core/minder.select.js'
// ,'module/view.js'
// ,'module/dragtree.js'
// ,'module/dropfile.js'
,'module/view.js'
,'module/dragtree.js'
,'module/dropfile.js'
,'module/keyboard.js'
,'module/select.js'
,'module/history.js'
......@@ -38,8 +38,9 @@
,'module/editor.selection.js'
,'module/basestyle.js'
,'module/font.js'
// ,'module/zoom.js'
,'module/zoom.js'
,'module/nodetext.js'
,'module/hyperlink.js'
,'ui/jquery-ui-1.10.4.custom.min.js'
,'ui/widget.js'
,'ui/button.js'
......
KityMinder.registerModule( "hyperlink", function () {
return {
"commands": {
"createlink" : kity.createClass( "hyperlink", {
base: Command,
execute: function (url) {
var nodes = km.getSelectedNodes();
if ( this.queryState( 'hyperlink' ) == 1 ) {
utils.each( nodes, function ( i, n ) {
n.setData( 'hyperlink' );
} )
} else {
utils.each( nodes, function ( i, n ) {
n.setData( 'hyperlink', url );
} )
}
},
queryState: function () {
var nodes = km.getSelectedNodes(),
result = 0;
if ( nodes.length == 0 ) {
return -1;
}
utils.each( nodes, function ( i, n ) {
if ( n && n.getData( 'hyperlink' ) ) {
result = 1;
return false;
}
} );
return result;
}
} )
},
"events": {
"RenderNodeRight": function ( e ) {
var node = e.node,url;
if(url = node.getData('h')){
var link = new kity.HyperLink(url);
var rect = new kity.Rect();
var box = node.getContRc().getBoundaryBox();
rect.setWidth(10).setHeight(10).fill('#ccc').setPosition(box.x + box.width + 2,rect.getHeight()/-2);
link.appendChild(rect);
node.getContRc().appendChild(link);
}
}
}
};
} );
\ 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