Commit 93fef115 authored by campaign's avatar campaign

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

Conflicts:
	CHANGELOG.md
parents d91d507d 52b2e4e0
......@@ -4,9 +4,11 @@
## v1.2.0
### 功能更新
1. 支持本地格式文件导入,包括拖文件和从网盘中打开,格式包含xmind/freemind/mindmanager
2. 添加只读模式,配置项 readOnly,添加动态调用接口setEnabled,setDisabled
1. 支持本地格式文件导入
* 支持文件拖拽和网盘文件导入
* 格式支持xmind/freemind/mindmanager,其他格式不支持
* 支持标签,包括优先级和任务进度
2. 新增节点移动到视野中
## v1.1.1
......@@ -23,6 +25,7 @@
1. 修复切换文件时,回复历史没有清空的问题
2. 修复在添加 markers 时,会出现 js 报错的问题
3. 仅有根节点,将其删除,再添加节点报错
## v1.1.0
......
......@@ -23,7 +23,8 @@
<link href="../themes/default/css/import.css" type="text/css" rel="stylesheet" />
<link href="../dialogs/dialogs.css" rel="stylesheet" type="text/css" />
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
<link href="favicon.ico" type="image/x-icon" rel="apple-touch-icon-precomposed">
</head>
<body>
......
......@@ -19,6 +19,8 @@
<link href="../dialogs/dialogs.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/links.css" />
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
<link href="favicon.ico" type="image/x-icon" rel="apple-touch-icon-precomposed">
</head>
......
......@@ -2,6 +2,9 @@ echo -e "\033[0;33;1mPublish start."
echo -e "\033[0;33;1m> Checking out gh-pages\033[0m"
git checkout -q gh-pages
echo -e "\033[0;33;1m> Merging server changes\033[0m"
git pull origin gh-pages
echo -e "\033[0;33;1m> Merging dev commits\033[0m"
git merge dev -qm "merge from dev"
......
......@@ -179,7 +179,7 @@ $( function () {
// 检查 URL 是否分享连接,是则加载分享内容
function loadShare() {
var pattern = /shareId=(\w+)([&#]|$)/;
var pattern = /(?:shareId|share_id)=(\w+)([&#]|$)/;
var match = pattern.exec( window.location ) || pattern.exec( document.referrer );
if ( !match ) return;
......
......@@ -28,7 +28,7 @@ KM.registerToolbarUI( 'node', function ( name ) {
comboboxWidget = $combox.kmui();
comboboxWidget.on( 'comboboxselect', function ( evt, res ) {
me.execCommand( res.value, new MinderNode( me.getLang().topic ) );
me.execCommand( res.value, new MinderNode( me.getLang().topic ), true );
} ).on( "beforeshow", function () {
if ( $combox.parent().length === 0 ) {
$combox.appendTo( me.$container.find( '.kmui-dialog-container' ) );
......
......@@ -32,7 +32,8 @@ function exportNode( node ) {
var DEFAULT_TEXT = {
'root': 'maintopic',
'main': 'topic'
'main': 'topic',
'sub': 'topic'
};
function importNode( node, json, km ) {
......@@ -40,14 +41,14 @@ function importNode( node, json, km ) {
for ( var field in data ) {
node.setData( field, data[ field ] );
}
node.setText( data.text || km.getLang( DEFAULT_TEXT[ data.type ] ) );
node.setText( data.text || km.getLang( DEFAULT_TEXT[ node.getType() ] ) );
var childrenTreeData = json.children;
if ( !childrenTreeData ) return;
for ( var i = 0; i < childrenTreeData.length; i++ ) {
var childNode = new MinderNode();
importNode( childNode, childrenTreeData[ i ], km );
node.appendChild( childNode );
importNode( childNode, childrenTreeData[ i ], km );
}
return node;
}
......
// 选区管理
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;
}
......
......@@ -142,6 +142,9 @@ KityMinder.registerModule( "TextEditModule", function () {
if(cmds[e.commandName]){
var node = km.getSelectedNode();
if( !node ){
return;
}
var textShape = node.getTextShape();
......
......@@ -134,11 +134,11 @@ KityMinder.registerModule( "KeyboardModule", function () {
this.receiver.keydownNode = node;
switch ( e.originEvent.keyCode ) {
case keys.Enter:
this.execCommand( 'appendSiblingNode', new MinderNode( this.getLang().topic ) );
this.execCommand( 'appendSiblingNode', new MinderNode( this.getLang().topic ), true );
e.preventDefault();
break;
case keys.Tab:
this.execCommand( 'appendChildNode', new MinderNode( this.getLang().topic ) );
this.execCommand( 'appendChildNode', new MinderNode( this.getLang().topic ), true );
e.preventDefault();
break;
case keys.Backspace:
......
......@@ -393,6 +393,21 @@ KityMinder.registerModule( "LayoutDefault", function () {
Layout.shicon.update();
}
};
var showNodeInView = function( node ){
var padding = 5;
var viewport = minder.getPaper().getViewPort();
var offset = node.getRenderContainer().getRenderBox( minder.getRenderContainer() );
var tmpX = viewport.center.x * 2 - (offset.x + offset.width);
var tmpY = viewport.center.y * 2 - (offset.y + offset.height);
var dx = offset.x < 0 ? -offset.x : Math.min(tmpX, 0);
var dy = offset.y < 0 ? -offset.y : Math.min(tmpY, 0);
km.getRenderContainer().fxTranslate( dx, dy, 100, "easeOutQuint" );
};
var _style = {
highlightNode: function ( node ) {
var highlight = node.isHighlight();
......@@ -485,7 +500,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
}
_root.setPoint( _root.getLayout().x, _root.getLayout().y );
},
appendChildNode: function ( parent, node, sibling ) {
appendChildNode: function ( parent, node, focus, sibling ) {
minder.handelNodeInsert( node );
node.clearLayout();
var Layout = node.getLayout();
......@@ -569,10 +584,14 @@ KityMinder.registerModule( "LayoutDefault", function () {
translateNode( set[ i ] );
updateConnectAndshIcon( set[ i ] );
}
if( focus ){
showNodeInView( node );
}
},
appendSiblingNode: function ( sibling, node ) {
appendSiblingNode: function ( sibling, node, focus ) {
var parent = sibling.getParent();
this.appendChildNode( parent, node, sibling );
this.appendChildNode( parent, node, focus, sibling );
},
removeNode: function ( nodes ) {
while ( nodes.length !== 0 ) {
......
......@@ -40,13 +40,13 @@ KityMinder.registerModule( "LayoutModule", function () {
} );
this.getLayoutStyle( curStyle ).initStyle.call( this );
},
appendChildNode: function ( parent, node, index ) {
appendChildNode: function ( parent, node, focus, index ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).appendChildNode.call( this, parent, node, index );
this.getLayoutStyle( curStyle ).appendChildNode.call( this, parent, node, focus, index );
},
appendSiblingNode: function ( sibling, node ) {
appendSiblingNode: function ( sibling, node, focus ) {
var curStyle = this.getCurrentStyle();
this.getLayoutStyle( curStyle ).appendSiblingNode.call( this, sibling, node );
this.getLayoutStyle( curStyle ).appendSiblingNode.call( this, sibling, node, focus );
},
removeNode: function ( nodes ) {
var curStyle = this.getCurrentStyle();
......@@ -104,12 +104,18 @@ KityMinder.registerModule( "LayoutModule", function () {
var AppendChildNodeCommand = kity.createClass( "AppendChildNodeCommand", ( function () {
return {
base: Command,
execute: function ( km, node ) {
execute: function ( km, node, focus, silbling ) {
var parent = km.getSelectedNode();
if( !parent ){
return null;
}
if ( parent.getType() !== "root" && parent.getChildren().length !== 0 && parent.getData( "expand" ) === false ) {
km.expandNode( parent );
}
km.appendChildNode( parent, node );
km.appendChildNode( parent, node, focus, silbling );
km.select( node, true );
return node;
},
......@@ -126,13 +132,17 @@ KityMinder.registerModule( "LayoutModule", function () {
var AppendSiblingNodeCommand = kity.createClass( "AppendSiblingNodeCommand", ( function () {
return {
base: Command,
execute: function ( km, node ) {
execute: function ( km, node, focus ) {
var selectedNode = km.getSelectedNode();
if( !selectedNode ){
return null;
}
if ( selectedNode.isRoot() ) {
node.setType( "main" );
km.appendChildNode( selectedNode, node );
km.appendChildNode( selectedNode, node, focus );
} else {
km.appendSiblingNode( selectedNode, node );
km.appendSiblingNode( selectedNode, node, focus );
}
km.select( node, true );
return node;
......@@ -152,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 = [];
......
......@@ -25,7 +25,7 @@ KityMinder.registerProtocal( 'mindmanager', function () {
function processTopic(topic, obj){
//处理文本
obj.data = { text : topic.Text && topic.Text.PlainText || '_' }; // 节点默认的文本,没有Text属性
obj.data = { text : topic.Text && topic.Text.PlainText || '' }; // 节点默认的文本,没有Text属性
// 处理标签
if(topic.Task){
......
......@@ -33,7 +33,7 @@ KityMinder.registerProtocal( "png", function () {
svgXml = km.getPaper().container.innerHTML;
renderContainer.translate( renderBox.x, renderBox.y );
$svg = $( svgXml );
$svg.attr( {
width: renderBox.width,
......@@ -44,6 +44,9 @@ KityMinder.registerProtocal( "png", function () {
// need a xml with width and height
svgXml = $( '<div></div' ).append( $svg ).html();
// svg 含有 &nbsp; 符号导出报错 Entity 'nbsp' not defined
svgXml = svgXml.replace(/&nbsp;/g, '&#xa0;');
blob = new Blob( [ svgXml ], {
type: "image/svg+xml;charset=utf-8"
} );
......
......@@ -3,7 +3,8 @@ KityMinder.registerProtocal( "svg", function () {
fileDescription: 'SVG 矢量图',
fileExtension: '.svg',
encode: function ( json, km ) {
return km.getPaper().container.innerHTML;
// svg 含有 &nbsp; 符号导出报错 Entity 'nbsp' not defined
return km.getPaper().container.innerHTML.replace( /&nbsp;/g, '&#xa0;' );
},
recognizePriority: -1
};
......
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