Commit 760ef778 authored by techird's avatar techird

Merge branch 'dev' of github.com:fex-team/kityminder into dev

parents 21b85f10 7933e106
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
5. 优化了输入文字时的卡顿效果 5. 优化了输入文字时的卡顿效果
6. 优化了当输入中文时,中文显示位置与光标距离过远的问题 6. 优化了当输入中文时,中文显示位置与光标距离过远的问题
7. html标签转码问题 7. html标签转码问题
8. 修复撤销按钮点击后,重做按钮还是不可点问题
## v1.1.2 ## v1.1.2
......
...@@ -75,11 +75,24 @@ module.exports = function ( grunt ) { ...@@ -75,11 +75,24 @@ module.exports = function ( grunt ) {
files: [ { files: [ {
src: [ 'dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html' ], src: [ 'dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html' ],
dest: distPath dest: distPath
}, { }]
src: [ 'kity/dist/kitygraph.all.min.js' ], },
dest: distPath + 'lib/', kity: {
flatten: true expand: true,
} ] cwd: 'kity/dist/',
src: '**',
dest: distPath + 'lib/'
},
km_config: {
expand: true,
src: 'kityminder.config.js',
dest: distPath
},
mise: {
files: [{
src: ['LICENSE', 'favicon.ico', 'README.md'],
dest: distPath
}]
} }
}, },
replace: { replace: {
...@@ -89,6 +102,18 @@ module.exports = function ( grunt ) { ...@@ -89,6 +102,18 @@ module.exports = function ( grunt ) {
replacements: [ { replacements: [ {
from: /kity\/dist\/kitygraph\.all\.js/ig, from: /kity\/dist\/kitygraph\.all\.js/ig,
to: 'lib/kitygraph.all.min.js' to: 'lib/kitygraph.all.min.js'
}, {
from: /import\.js/,
to: 'kityminder.all.min.js'
} ]
},
noCache: {
src: distPath + 'index.html',
overwrite: true,
replacements: [ {
from: /src=\"(.+?)\.js\"/ig,
to: 'src="$1.js?_=' + +new Date() + '"'
} ] } ]
} }
}, },
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
helpContent += '<ul>'; helpContent += '<ul>';
helpContent += ' <li><h3>插入子节点:</h3>在选中的节点中按 Tab 键</li>'; helpContent += ' <li><h3>插入子节点:</h3>在选中的节点中按 Tab 键</li>';
helpContent += ' <li><h3>插入同级节点:</h3>在选中的节点中按 Enter/Return 键</li>'; helpContent += ' <li><h3>插入同级节点:</h3>在选中的节点中按 Enter/Return 键</li>';
helpContent += ' <li><h3>编辑节点:</h3>刚插入的子节点和同级节点会进入编辑模式;其他节点双击也能进入编辑模式;编辑模式下可以编辑节点的文本</li>'; helpContent += ' <li><h3>编辑节点:</h3>选中节点直接输入文字、双击节点或选中节点按F2键均可进入编辑模式</li>';
helpContent += ' <li><h3>设置节点文本格式:</h3>你可以选中一个或多个节点后,在工具栏中改变选中节点的文本格式。也可以使用快捷键来使用这些功能:撤销(Ctrl+Z)、重做(Ctrl+Y)、加粗(Ctrl+B)、斜体(Ctrl+I)</li>'; helpContent += ' <li><h3>设置节点文本格式:</h3>你可以选中一个或多个节点后,在工具栏中改变选中节点的文本格式。也可以使用快捷键来使用这些功能:撤销(Ctrl+Z)、重做(Ctrl+Y)、加粗(Ctrl+B)、斜体(Ctrl+I)</li>';
helpContent += ' <li><h3>添加标签:</h3>选中节点,点击工具栏上的‘添加标签’按钮可以为节点添加/删除标签</li>'; helpContent += ' <li><h3>添加标签:</h3>选中节点,点击工具栏上的‘添加标签’按钮可以为节点添加/删除标签</li>';
helpContent += ' <li><h3>添加/删除超链接:</h3>选中节点,点击工具栏上的‘添加超链接’/‘删除超链接’按钮可以为节点添加、删除超链接</li>'; helpContent += ' <li><h3>添加/删除超链接:</h3>选中节点,点击工具栏上的‘添加超链接’/‘删除超链接’按钮可以为节点添加、删除超链接</li>';
......
( function () { ( function ( utils ) {
//todo 这里先写死成中文 //todo 这里先写死成中文
var content = '<div class="hyperlink-content" style="padding:20px;width:360px;">'; var content = '<div class="hyperlink-content" style="padding:20px;width:360px;">';
content += '<style>'; content += '<style>';
...@@ -52,6 +52,12 @@ ...@@ -52,6 +52,12 @@
km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() ); km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() );
$w.kmui().hide(); $w.kmui().hide();
} ); } );
$w.find( '#hyperlink_href' ).on( 'keydown', function ( e ) {
if ( e.keyCode === 13 ) {
km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() );
$w.kmui().hide();
}
} );
var url = km.queryCommandValue( 'hyperlink' ); var url = km.queryCommandValue( 'hyperlink' );
var $input = $w.find( '#hyperlink_href' ); var $input = $w.find( '#hyperlink_href' );
$input.val( url || 'http://' ); $input.val( url || 'http://' );
...@@ -61,4 +67,4 @@ ...@@ -61,4 +67,4 @@
}, },
width: 400 width: 400
} ); } );
} )(); } )( KM.Utils );
\ No newline at end of file \ No newline at end of file
( function () { ( function ( utils ) {
KM.registerWidget( 'markers', { KM.registerWidget( 'markers', {
tpl:"<style>"+ tpl: "<style>" +
".kmui-dialog-<%= container %> .priority .icon{background:url(dialogs/markers/images/iconpriority.png) 0 0}"+ ".kmui-dialog-<%= container %> .priority .icon{background:url(dialogs/markers/images/iconpriority.png) 0 0}" +
".kmui-dialog-<%= container %> .progress .icon{background:url(dialogs/markers/images/iconprogress.png) 0 0}"+ ".kmui-dialog-<%= container %> .progress .icon{background:url(dialogs/markers/images/iconprogress.png) 0 0}" +
".kmui-dialog-<%= container %> .icon.p2{background-position: -20px 0}"+ ".kmui-dialog-<%= container %> .icon.p2{background-position: -20px 0}" +
".kmui-dialog-<%= container %> .icon.p3{background-position: -40px 0}"+ ".kmui-dialog-<%= container %> .icon.p3{background-position: -40px 0}" +
".kmui-dialog-<%= container %> .icon.p4{background-position: -60px 0}"+ ".kmui-dialog-<%= container %> .icon.p4{background-position: -60px 0}" +
".kmui-dialog-<%= container %> .icon.p5{background-position: -80px 0}"+ ".kmui-dialog-<%= container %> .icon.p5{background-position: -80px 0}" +
"</style>"+ "</style>" +
"<ul class='icon-list priority'>" + "<ul class='icon-list priority'>" +
"<li value='1' type='priority'><span class='icon p1'></span><span><%= priority %>1</span></li>" + "<li value='1' type='priority'><span class='icon p1'></span><span><%= priority %>1</span></li>" +
"<li value='2' type='priority'><span class='icon p2'></span><span><%= priority %>2</span></li>" + "<li value='2' type='priority'><span class='icon p2'></span><span><%= priority %>2</span></li>" +
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
"<li value='4' type='progress'><span class='icon p4'></span><span><%= progress.threequartersdone %></span></li>" + "<li value='4' type='progress'><span class='icon p4'></span><span><%= progress.threequartersdone %></span></li>" +
"<li value='5' type='progress'><span class='icon p5'></span><span><%= progress.done %></span></li>" + "<li value='5' type='progress'><span class='icon p5'></span><span><%= progress.done %></span></li>" +
"</ul>", "</ul>",
initContent: function ( km ,$w) { initContent: function ( km, $w ) {
var lang = km.getLang( 'dialogs.markers' ); var lang = km.getLang( 'dialogs.markers' );
if ( lang ) { if ( lang ) {
var html = $.parseTmpl( this.tpl, utils.extend({'container':'markers'},lang) ); var html = $.parseTmpl( this.tpl, utils.extend( {
'container': 'markers'
}, lang ) );
} }
this.root().html( html ); this.root().html( html );
}, },
...@@ -53,4 +55,4 @@ ...@@ -53,4 +55,4 @@
width: 200 width: 200
} ) } )
} )(); } )( KM.Utils );
\ No newline at end of file \ No newline at end of file
Copyright (c) 2014, FEX,Baidu.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the {organization} nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
Kity Minder
==========
## 简介
KityMinder 是百度 FEX 团队的 f-cube 小组(原UEditor小组)的又一力作。作为一款在线的脑图编辑工具,它有着很多Native编辑工具的交互体验。KM与UE有着一样的宗旨,就是注重最终用户的使用体验。同时,它充分发挥了Web云存储的优势,可以直接将编辑中的脑图同步到云端。此外,借由独创的 “云盘分享”功能,用户可以一键将当前编辑的脑图直接生成在线链接共享给其他用户,实现无缝沟通。
![KityMinder](summary.jpg "KityMinder 界面")
KM是基于SVG技术实现,使用JavaScript+html实现。支持绝大多数的主流浏览器。
支持列表如下
1. Chrome
2. Firefox
3. Safari
4. IE9+
## 线上版本
产品地址:[http://naotu.baidu.com](http://naotu.baidu.com)
注意:由于历史原因,有三个发布过的公开地址:
1. [~~http://fex-team.baidu.com/kityminder/dist~~](http://fex-team.baidu.com/kityminder/dist)
2. [~~http://kitygraph.github.io/kityminder/dist~~](http://kitygraph.github.io/kityminder/dist)
3. [http://fex.baidu.com/kityminder/dist](http://fex.baidu.com/kityminder/dist)
第 1 个地址已经失效;
第 2 个地址不再维护更新(原因是我们项目地址迁移到了 fex-team);
第 3 个地址是更新频率最高的地址,新功能可以在这里尝鲜;
[产品地址](http://naotu.baidu.com)已经稳定,请大家放心使用。地址变动频繁带来的不便,请谅解。
## 依赖说明
KityMinder 依赖 Kity 库。刚下载的压缩包或者刚从 github 拉下来的代码会有一个空的 kity 目录。要运行调试,必须加载 Kity 的依赖:
1. 如果你下载的是 KityMinder 的压缩包,那么需要手动下载 [Kity](http://kitygraph.github.io/kityminder/kity/dist/kitygraph.all.js) 库到 kity/dist/kitygraph.all.js
2. 如果你是从 github 上拉源代码下来的,那么可以更新一下子模块:
```bash
cd YOUR_KITYMINDER_PATH
git submodule init
git submodule update
```
## 联系我们
邮件: kity@baidu.com
讨论群: 374918234
#github-url{position:absolute;width:130px;height:130px;right:-90px;top:60px;background-color:#fff;border-radius:65px;box-shadow:-3px 1px 10px rgba(0,0,0,0.3);-webkit-transition:all .2s ease;-moz-transition:all .2s ease;-ms-transition:all .2s ease;transition:all .2s ease;opacity:.3;cursor:pointer}#github-url:hover{-webkit-transform:translate(-280px);-moz-transform:translate(-280px);-ms-transform:translate(-280px);transform:translate(-280px);opacity:1}
#github-url:before{content:' ';display:block;position:absolute;width:300px;height:130px;left:65px;top:0;background:rgba(0,0,0,0.001)}
#github-url:after{content:' ';display:block;position:absolute;width:130px;height:130px;background:url(../img/github_mark.png) no-repeat 5px 4px}
#github-url a{display:block;position:absolute;top:40px;font-size:18px;width:300px;height:40px;padding:10px 0 10px 20px;line-height:40px;color:#000;left:120px;border-radius:0 25px 25px 0;background-color:#fff}
#about{position:absolute;bottom:10px;right:10px;height:24px;line-height:24px;color:#888;font-family:Arial;font-size:13px;font-weight:normal;margin:0;text-shadow:0 1px 1px #000}#about a{color:#888}#about a:hover{color:#fff}
#km-version.new-version{position:relative;padding-right:30px}
#km-version.new-version:after{content:'NEW';color:#ff0;position:absolute;top:-10px;right:-5px;display:block;background:#f00;padding:0 5px;border-radius:4px;text-shadow:none;box-shadow:-1px 1px 3px rgba(0,0,0,0.3);-webkit-transform:scale(.6);-moz-transform:scale(.6);-ms-transform:scale(.6);transform:scale(.6)}
@bg: #FFF;
#github-url {
position: absolute;
width: 130px;
height: 130px;
right: -90px;
top: 60px;
background-color: @bg;
border-radius: 65px;
box-shadow: -3px 1px 10px rgba(0,0,0,.3);
-webkit-transition: all .2s ease;
-moz-transition: all .2s ease;
-ms-transition: all .2s ease;
transition: all .2s ease;
opacity: .3;
cursor: pointer;
&:hover {
-webkit-transform: translate(-280px);
-moz-transform: translate(-280px);
-ms-transform: translate(-280px);
transform: translate(-280px);
opacity: 1;
}
&:before {
content: ' ';
display: block;
position: absolute;
width: 300px;
height: 130px;
left: 65px;
top: 0;
background: rgba(0,0,0,0.001);
}
&:after {
content: ' ';
display: block;
position: absolute;
width: 130px;
height: 130px;
background: url(../img/github_mark.png) no-repeat 5px 4px;
}
a {
display: block;
position: absolute;
top: 40px;
font-size: 18px;
width: 300px;
height: 40px;
padding: 10px 0 10px 20px;
line-height: 40px;
color: black;
left: 120px;
border-radius: 0 25px 25px 0;
background-color: @bg;
}
}
#about {
position: absolute;
bottom: 10px;
right: 10px;
height: 24px;
line-height: 24px;
color: #888;
font-family: Arial;
font-size: 13px;
font-weight: normal;
margin: 0;
text-shadow: 0 1px 1px black;
a {
color: #888;
&:hover {
color: white;
}
}
}
#km-version.new-version {
position: relative;
padding-right: 30px;
}
#km-version.new-version:after {
content: 'NEW';
color: yellow;
position: absolute;
top: -10px;
right: -5px;
display: block;
background: red;
padding: 0 5px;
border-radius: 4px;
text-shadow: none;
box-shadow: -1px 1px 3px rgba(0,0,0,.3);
-webkit-transform: scale(.6);
-moz-transform: scale(.6);
-ms-transform: scale(.6);
transform: scale(.6);
}
\ No newline at end of file
.priority .icon {background:url(../dialogs/icons/iconpriority.png) 0 0}
.progress .icon{background:url(../dialogs/icons/iconprogress.png) 0 0}
.icon.p2{background-position: -20px 0}
.icon.p3{background-position: -40px 0}
.icon.p4{background-position: -60px 0}
.icon.p5{background-position: -80px 0}
\ No newline at end of file
...@@ -6,8 +6,10 @@ ...@@ -6,8 +6,10 @@
helpContent += '<ul>'; helpContent += '<ul>';
helpContent += ' <li><h3>插入子节点:</h3>在选中的节点中按 Tab 键</li>'; helpContent += ' <li><h3>插入子节点:</h3>在选中的节点中按 Tab 键</li>';
helpContent += ' <li><h3>插入同级节点:</h3>在选中的节点中按 Enter/Return 键</li>'; helpContent += ' <li><h3>插入同级节点:</h3>在选中的节点中按 Enter/Return 键</li>';
helpContent += ' <li><h3>编辑节点:</h3>刚插入的子节点和同级节点会进入编辑模式;其他节点双击也能进入编辑模式;编辑模式下可以编辑节点的文本</li>'; helpContent += ' <li><h3>编辑节点:</h3>选中节点直接输入文字、双击节点或选中节点按F2键均可进入编辑模式</li>';
helpContent += ' <li><h3>设置节点样式:</h3>你可以选中一个或多个节点后,在工具栏中改变选中节点的样式。也可以使用快捷键来使用这些功能:撤销(Ctrl+Z)、重做(Ctrl+Y)、加粗(Ctrl+B)、斜体(Ctrl+I)</li>'; helpContent += ' <li><h3>设置节点文本格式:</h3>你可以选中一个或多个节点后,在工具栏中改变选中节点的文本格式。也可以使用快捷键来使用这些功能:撤销(Ctrl+Z)、重做(Ctrl+Y)、加粗(Ctrl+B)、斜体(Ctrl+I)</li>';
helpContent += ' <li><h3>添加标签:</h3>选中节点,点击工具栏上的‘添加标签’按钮可以为节点添加/删除标签</li>';
helpContent += ' <li><h3>添加/删除超链接:</h3>选中节点,点击工具栏上的‘添加超链接’/‘删除超链接’按钮可以为节点添加、删除超链接</li>';
helpContent += '</ul>'; helpContent += '</ul>';
helpContent += '<h2>导入导出</h2>'; helpContent += '<h2>导入导出</h2>';
...@@ -36,6 +38,7 @@ ...@@ -36,6 +38,7 @@
helpContent += ' <li><h3>视野拖动:</h3>根节点未被选中的情况下,拖动根节点可以拖动视野;或者使用空格键切换拖动状态</li>'; helpContent += ' <li><h3>视野拖动:</h3>根节点未被选中的情况下,拖动根节点可以拖动视野;或者使用空格键切换拖动状态</li>';
helpContent += ' <li><h3>视野缩放:</h3>点击工具栏中的“放大”和“缩小”按钮可以缩放视野,或者按着 Ctrl 键使用滚轮缩放</li>'; helpContent += ' <li><h3>视野缩放:</h3>点击工具栏中的“放大”和“缩小”按钮可以缩放视野,或者按着 Ctrl 键使用滚轮缩放</li>';
helpContent += ' <li><h3>视野复位:</h3>双击空白处,可以将视野复位</li>'; helpContent += ' <li><h3>视野复位:</h3>双击空白处,可以将视野复位</li>';
helpContent += ' <li><h3>展开/收起节点:</h3>选中单个节点,点击工具栏中的“展开节点”和“收起节点”按钮可以展开/收起节点下的全部子节点</li>';
helpContent += '</ul>'; helpContent += '</ul>';
helpContent += '</div>'; helpContent += '</div>';
......
( function () { ( function ( utils ) {
//todo 这里先写死成中文 //todo 这里先写死成中文
var content = '<div class="hyperlink-content" style="padding:20px;width:360px;">'; var content = '<div class="hyperlink-content" style="padding:20px;width:360px;">';
content += '<p><label>输入链接: <input id="hyperlink_href" style="width:90%;" /></label></p>'; content += '<style>';
content += '<p style="text-align:right"><button id="hyperlink_insert">插入</button></p>'; content += '.kmui-dialog-<%= container %> input{';
content += 'width: 75%;';
content += 'padding: 6px 12px;';
content += 'font-size: 14px;';
content += 'line-height: 1.42857143;';
content += 'color: #555;';
content += 'background-color: #fff;';
content += 'background-image: none;';
content += 'border: 1px solid #ccc;';
content += 'border-radius: 4px; -webkit-box-shadow: inset 0 1px 1px rgba( 0, 0, 0, .075 );'
content += 'box-shadow: inset 0 1px 1px rgba( 0, 0, 0, .075 ); -webkit-transition: border-color ease-in-out .15s,';
content += 'box-shadow ease-in-out .15s;';
content += 'transition: border-color ease-in-out .15s,';
content += 'box-shadow ease-in-out .15s;';
content += '}';
content += '.kmui-dialog-<%= container %> input:focus{';
content += 'border-color: #66afe9;';
content += 'outline: 0;';
content += '-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);';
content += 'box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);';
content += '}';
content += '.kmui-dialog-<%= container %> button{';
content += 'height:34px;';
content += 'line-height:34px;';
content += 'vertical-align:1px';
content += '}';
content += '</style>';
content += '<input id="hyperlink_href"/>';
content += '<button id="hyperlink_insert">插入</button>';
content += '</div>'; content += '</div>';
KM.registerWidget( 'hyperlink', { KM.registerWidget( 'hyperlink', {
tpl: content, tpl: content,
initContent: function ( km ) { initContent: function ( km ) {
var lang = km.getLang( 'dialogs.hyperlink' ), var lang = km.getLang( 'dialogs.hyperlink' ),
html; html;
if ( lang ) { if ( lang ) {
html = $.parseTmpl( this.tpl, lang ); html = $.parseTmpl( this.tpl, utils.extend( {
'container': 'hyperlink'
}, lang ) );
} }
this.root().html( html ); this.root().html( html );
}, },
initEvent: function ( km, $w ) { initEvent: function ( km, $w ) {
$w.find('#hyperlink_insert').on('click',function(){ $w.find( '#hyperlink_insert' ).on( 'click', function () {
km.execCommand('hyperlink',$w.find('#hyperlink_href').val()); km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() );
$w.kmui().hide(); $w.kmui().hide();
}); } );
var url = km.queryCommandValue('hyperlink'); $w.find( '#hyperlink_href' ).on( 'keydown', function ( e ) {
var $input = $w.find('#hyperlink_href'); if ( e.keyCode === 13 ) {
$input.val(url || 'http://'); km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() );
setTimeout(function(){ $w.kmui().hide();
}
} );
var url = km.queryCommandValue( 'hyperlink' );
var $input = $w.find( '#hyperlink_href' );
$input.val( url || 'http://' );
setTimeout( function () {
$input.focus() $input.focus()
}) } )
}, },
width: 400 width: 400
} ); } );
} )(); } )( KM.Utils );
\ No newline at end of file \ No newline at end of file
( function () { ( function ( utils ) {
KM.registerWidget( 'markers', { KM.registerWidget( 'markers', {
tpl:"<style>"+ tpl: "<style>" +
".kmui-dialog-<%= container %> .priority .icon{background:url(dialogs/markers/images/iconpriority.png) 0 0}"+ ".kmui-dialog-<%= container %> .priority .icon{background:url(dialogs/markers/images/iconpriority.png) 0 0}" +
".kmui-dialog-<%= container %> .progress .icon{background:url(dialogs/markers/images/iconprogress.png) 0 0}"+ ".kmui-dialog-<%= container %> .progress .icon{background:url(dialogs/markers/images/iconprogress.png) 0 0}" +
".kmui-dialog-<%= container %> .icon.p2{background-position: -20px 0}"+ ".kmui-dialog-<%= container %> .icon.p2{background-position: -20px 0}" +
".kmui-dialog-<%= container %> .icon.p3{background-position: -40px 0}"+ ".kmui-dialog-<%= container %> .icon.p3{background-position: -40px 0}" +
".kmui-dialog-<%= container %> .icon.p4{background-position: -60px 0}"+ ".kmui-dialog-<%= container %> .icon.p4{background-position: -60px 0}" +
".kmui-dialog-<%= container %> .icon.p5{background-position: -80px 0}"+ ".kmui-dialog-<%= container %> .icon.p5{background-position: -80px 0}" +
"</style>"+ "</style>" +
"<ul class='icon-list priority'>" + "<ul class='icon-list priority'>" +
"<li value='1' type='priority'><span class='icon p1'></span><span><%= priority %>1</span></li>" + "<li value='1' type='priority'><span class='icon p1'></span><span><%= priority %>1</span></li>" +
"<li value='2' type='priority'><span class='icon p2'></span><span><%= priority %>2</span></li>" + "<li value='2' type='priority'><span class='icon p2'></span><span><%= priority %>2</span></li>" +
...@@ -22,10 +22,12 @@ ...@@ -22,10 +22,12 @@
"<li value='4' type='progress'><span class='icon p4'></span><span><%= progress.threequartersdone %></span></li>" + "<li value='4' type='progress'><span class='icon p4'></span><span><%= progress.threequartersdone %></span></li>" +
"<li value='5' type='progress'><span class='icon p5'></span><span><%= progress.done %></span></li>" + "<li value='5' type='progress'><span class='icon p5'></span><span><%= progress.done %></span></li>" +
"</ul>", "</ul>",
initContent: function ( km ,$w) { initContent: function ( km, $w ) {
var lang = km.getLang( 'dialogs.markers' ); var lang = km.getLang( 'dialogs.markers' );
if ( lang ) { if ( lang ) {
var html = $.parseTmpl( this.tpl, utils.extend({'container':'markers'},lang) ); var html = $.parseTmpl( this.tpl, utils.extend( {
'container': 'markers'
}, lang ) );
} }
this.root().html( html ); this.root().html( html );
}, },
...@@ -53,4 +55,4 @@ ...@@ -53,4 +55,4 @@
width: 200 width: 200
} ) } )
} )(); } )( KM.Utils );
\ No newline at end of file \ No newline at end of file
...@@ -2,27 +2,31 @@ ...@@ -2,27 +2,31 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="title" content="百度脑图">
<meta name="keyword" content="脑图,kity,svg,minder,百度,fex,前端,在线">
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js" charset="utf-8"></script> <script src="lib/jquery-2.1.0.min.js?_=1399605674500" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1399605674500" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } ); ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } );
</script> </script>
<script src="lib/kitygraph.all.min.js" charset="utf-8"></script> <script src="lib/kitygraph.all.min.js?_=1399605674500" charset="utf-8"></script>
<script src="import.js" charset="utf-8"></script> <script src="kityminder.all.min.js?_=1399605674500" charset="utf-8"></script>
<script src="kityminder.config.js" charset="utf-8"></script> <script src="kityminder.config.js?_=1399605674500" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js" charset="utf-8"></script> <script src="lang/zh-cn/zh-cn.js?_=1399605674500" charset="utf-8"></script>
<script src="lib/zip.js" charset="utf-8"></script> <script src="lib/zip.js?_=1399605674500" charset="utf-8"></script>
<script> <script>
zip.inflateJSPath = 'lib/inflate.js'; zip.inflateJSPath = 'lib/inflate.js';
</script> </script>
<script src="lib/jquery.xml2json.js" charset="utf-8"></script> <script src="lib/jquery.xml2json.js?_=1399605674500" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script> <script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399605674500" charset="utf-8"></script>
<script src="social/draftmanager.js" charset="utf-8"></script> <script src="social/draftmanager.js?_=1399605674500" charset="utf-8"></script>
<script src="social/social.js" charset="utf-8"></script> <script src="social/social.js?_=1399605674500" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet"> <link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" /> <link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
...@@ -48,10 +52,38 @@ ...@@ -48,10 +52,38 @@
</p> </p>
</div> </div>
<p id="about">
KityMinder <a id="km-version" href="https://github.com/fex-team/kityminder/blob/dev/CHANGELOG.md" target="blank"></a>, Powered by f-cube, <a href="http://fex.baidu.com" target="_blank">FEX</a> |
<a href="https://github.com/fex-team/kityminder.git" target="_blank">Source</a>
<a href="https://github.com/fex-team/kityminder/issues/new" target="_blank">Bug</a> |
<a href="mailto:kity@baidu.com" target="_blank">Contact Us</a>
</p>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
</body> </body>
<script> <script>
// create km instance // create km instance
window.km = KM.getKityMinder('kityminder'); window.km = KM.getKityMinder('kityminder');
// New Version Notify
$(function() {
var lastVersion = localStorage.lastKMVersion;
$('#km-version').text( 'v' + KM.version );
if( lastVersion != KM.version ) {
$( '#km-version' ).addClass( 'new-version' );
localStorage.lastKMVersion = KM.version;
}
});
</script>
<!--Baidu Tongji Code-->
<script type="text/javascript">
if (document.domain == 'naotu.baidu.com') {
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F0703917f224067c887f3664479a03887' type='text/javascript'%3E%3C/script%3E"));
}
</script> </script>
</html> </html>
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
( function () {
function getKMBasePath( docUrl, confUrl ) {
return getBasePath( docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath() );
}
function getConfigFilePath() {
var configPath = document.getElementsByTagName( 'script' );
return configPath[ configPath.length - 1 ].src;
}
function getBasePath( docUrl, confUrl ) {
var basePath = confUrl;
if ( /^(\/|\\\\)/.test( confUrl ) ) {
basePath = /^.+?\w(\/|\\\\)/.exec( docUrl )[ 0 ] + confUrl.replace( /^(\/|\\\\)/, '' );
} else if ( !/^[a-z]+:/i.test( confUrl ) ) {
docUrl = docUrl.split( "#" )[ 0 ].split( "?" )[ 0 ].replace( /[^\\\/]+$/, '' );
basePath = docUrl + "" + confUrl;
}
return optimizationPath( basePath );
}
function optimizationPath( path ) {
var protocol = /^[a-z]+:\/\//.exec( path )[ 0 ],
tmp = null,
res = [];
path = path.replace( protocol, "" ).split( "?" )[ 0 ].split( "#" )[ 0 ];
path = path.replace( /\\/g, '/' ).split( /\// );
path[ path.length - 1 ] = "";
while ( path.length ) {
if ( ( tmp = path.shift() ) === ".." ) {
res.pop();
} else if ( tmp !== "." ) {
res.push( tmp );
}
}
return protocol + res.join( "/" );
}
window.KITYMINDER_CONFIG = {
'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏
toolbars: [
'hand | zoom-in zoom zoom-out | collapsenode expandnode | undo redo | bold italic | fontfamily fontsize forecolor | saveto | hyperlink unhyperlink | markers | node | help'
]
//只读模式,默认是false
//readOnly: true
//设置主题
//,defaultlayoutstyle : 'default' //设置默认的主题
//,layoutstyle : [] //添加有那些主图
//回退相关选项
//,maxUndoCount:20 //最大可回退的次数,默认20
//语言默认是zh-cn
//,lang:'zh-cn'
//设置km整体的z-index大小
//,zIndex : 1000
//设置初始加载时展开的层数和子节点数目阈值
//默认是全部展开,0表示全部展开
// ,
// defaultExpand: {
// defaultLayer: 2,
// defaultSubShow: 5
// }
//配置放大缩小的比例
//,zoom:[50,80,100,120,150,200]
};
} )();
\ No newline at end of file
...@@ -13,16 +13,15 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -13,16 +13,15 @@ KityMinder.LANG[ 'zh-cn' ] = {
'node': '节点操作', 'node': '节点操作',
'saveto': '导出', 'saveto': '导出',
'hand': '允许拖拽', 'hand': '允许拖拽',
'zoom-in': '放大', 'zoom': '放大缩小',
'zoom-out': '缩小',
'markers': '添加标签', 'markers': '添加标签',
'switchlayout': '切换主题', 'switchlayout': '切换主题',
'help': '帮助', 'help': '帮助',
'preference': '偏好设置', 'preference': '偏好设置',
'hyperlink':'插入链接', 'hyperlink': '插入链接',
'unhyperlink':"删除链接", 'unhyperlink': "删除链接",
'expandnode':"展开节点", 'expandnode': "展开节点",
'collapsenode':"闭合节点" 'collapsenode': "收起节点"
}, },
'popupcolor': { 'popupcolor': {
'clearColor': '清空颜色', 'clearColor': '清空颜色',
...@@ -49,7 +48,7 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -49,7 +48,7 @@ KityMinder.LANG[ 'zh-cn' ] = {
'help': { 'help': {
}, },
hyperlink:{} hyperlink: {}
}, },
'node': { 'node': {
'appendsiblingnode': '插入同级节点', 'appendsiblingnode': '插入同级节点',
...@@ -60,6 +59,10 @@ KityMinder.LANG[ 'zh-cn' ] = { ...@@ -60,6 +59,10 @@ KityMinder.LANG[ 'zh-cn' ] = {
'layout': { 'layout': {
'default': '左右展开', 'default': '左右展开',
'bottom': '向下展开' 'bottom': '向下展开'
},
'hyperlink':{
'hyperlink':'插入超链接',
'unhyperlink':"取消超链接"
} }
}; };
\ No newline at end of file
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -41,6 +41,9 @@ html, body, #kityminder, div.kmui-editor-body { ...@@ -41,6 +41,9 @@ html, body, #kityminder, div.kmui-editor-body {
/*line-height: 0;*/ /*line-height: 0;*/
overflow: hidden; overflow: hidden;
} }
svg { svg, body {
font-family: Arial, "Microsoft Yahei","Heiti SC",sans-serif; font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif;
} }
\ No newline at end of file #about{position:absolute;bottom:10px;right:10px;height:24px;line-height:24px;color:#888;font-family:Arial;font-size:13px;font-weight:normal;margin:0;text-shadow:0 1px 1px #000}#about a{color:#888}#about a:hover{color:#fff}
#km-version.new-version{position:relative;padding-right:30px}
#km-version.new-version:after{content:'NEW';color:#ff0;position:absolute;top:-10px;right:-5px;display:block;background:#f00;padding:0 5px;border-radius:4px;text-shadow:none;box-shadow:-1px 1px 3px rgba(0,0,0,0.3);-webkit-transform:scale(.6);-moz-transform:scale(.6);-ms-transform:scale(.6);transform:scale(.6)}
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="title" content="百度脑图">
<meta name="keyword" content="脑图,kity,svg,minder,百度,fex,前端,在线">
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script> <script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js" charset="utf-8"></script> <script src="lib/ZeroClipboard.min.js" charset="utf-8"></script>
...@@ -48,10 +52,38 @@ ...@@ -48,10 +52,38 @@
</p> </p>
</div> </div>
<p id="about">
KityMinder <a id="km-version" href="https://github.com/fex-team/kityminder/blob/dev/CHANGELOG.md" target="blank"></a>, Powered by f-cube, <a href="http://fex.baidu.com" target="_blank">FEX</a> |
<a href="https://github.com/fex-team/kityminder.git" target="_blank">Source</a>
<a href="https://github.com/fex-team/kityminder/issues/new" target="_blank">Bug</a> |
<a href="mailto:kity@baidu.com" target="_blank">Contact Us</a>
</p>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script> <script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
</body> </body>
<script> <script>
// create km instance // create km instance
window.km = KM.getKityMinder('kityminder'); window.km = KM.getKityMinder('kityminder');
// New Version Notify
$(function() {
var lastVersion = localStorage.lastKMVersion;
$('#km-version').text( 'v' + KM.version );
if( lastVersion != KM.version ) {
$( '#km-version' ).addClass( 'new-version' );
localStorage.lastKMVersion = KM.version;
}
});
</script>
<!--Baidu Tongji Code-->
<script type="text/javascript">
if (document.domain == 'naotu.baidu.com') {
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F0703917f224067c887f3664479a03887' type='text/javascript'%3E%3C/script%3E"));
}
</script> </script>
</html> </html>
\ No newline at end of file
Subproject commit efa481b263c2727e90101edc7710dd9a9a393f5f Subproject commit afbb101c5b3d7518080bac3886f16043a482b7c9
...@@ -42,15 +42,14 @@ KM.registerToolbarUI( 'hyperlink', function ( name ) { ...@@ -42,15 +42,14 @@ KM.registerToolbarUI( 'hyperlink', function ( name ) {
label: me.getLang( 'hyperlink.hyperlink' ), label: me.getLang( 'hyperlink.hyperlink' ),
exec: function (url) { exec: function (url) {
$dialog.kmui().show(); $dialog.kmui().show();
this.execCommand( 'hyperlink', url )
}, },
cmdName: 'hyperlink' cmdName: 'hyperlink'
},{ },{
label: me.getLang( 'hyperlink.unhyperlink' ), label: me.getLang( 'hyperlink.unhyperlink' ),
exec: function (url) { exec: function () {
this.execCommand( 'unhyperlink' ) this.execCommand( 'unhyperlink' )
}, },
cmdName: 'hyperlink' cmdName: 'unhyperlink'
} }
]); ]);
......
...@@ -66,6 +66,14 @@ kity.extendClass( Minder, { ...@@ -66,6 +66,14 @@ kity.extendClass( Minder, {
this._hasEnterExecCommand = false; this._hasEnterExecCommand = false;
} else { } else {
result = cmd.execute.apply( cmd, [ me ].concat( cmdArgs ) ); result = cmd.execute.apply( cmd, [ me ].concat( cmdArgs ) );
if(!this._hasEnterExecCommand){
if ( cmd.isSelectionChanged() ) {
this._firePharse( new MinderEvent( 'selectionchange' ) );
}
this._firePharse( new MinderEvent( 'interactchange' ) );
}
} }
return result === undefined ? null : result; return result === undefined ? null : result;
......
...@@ -18,14 +18,17 @@ var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', { ...@@ -18,14 +18,17 @@ var MoveToParentCommand = kity.createClass( 'MoveToParentCommand', {
base: Command, base: Command,
execute: function ( minder, nodes, parent ) { execute: function ( minder, nodes, parent ) {
var node; var node;
if ( ( !parent.isExpanded() ) && ( parent.getChildren().length > 0 ) && ( parent.getType() !== 'root' ) ) {
minder.expandNode( parent );
}
for ( var i = nodes.length - 1; i >= 0; i-- ) { for ( var i = nodes.length - 1; i >= 0; i-- ) {
node = nodes[ i ]; node = nodes[ i ];
if ( node.getParent() ) { if ( node.getParent() ) {
minder.removeNode( [ node ] ); minder.removeNode( [ node ] );
if ( !parent.isExpanded() && parent.getChildren().length > 0 && parent.getType() !== 'root' ) {
minder.expandNode( parent );
}
minder.appendChildNode( parent, node ); minder.appendChildNode( parent, node );
if ( node.isExpanded() && node.getChildren().length !== 0 ) {
minder.expandNode( node );
}
} }
} }
minder.select( nodes, true ); minder.select( nodes, true );
......
...@@ -227,8 +227,8 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -227,8 +227,8 @@ Minder.Receiver = kity.createClass( 'Receiver', {
} }
return this; return this;
}, },
getBaseOffset: function ( ) { getBaseOffset: function ( refer ) {
var rb = this.textShape.getRenderBox( this.km.getRenderContainer() ); var rb = this.textShape.getRenderBox( refer || this.km.getRenderContainer() );
// if(!this.pr) { // if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green')); // this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// } // }
...@@ -240,7 +240,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -240,7 +240,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return this; return this;
}, },
setContainerStyle: function () { setContainerStyle: function () {
var textShapeBox = this.getBaseOffset(); var textShapeBox = this.getBaseOffset('screen');
this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 5 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;'; this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 5 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;';
return this; return this;
......
KityMinder.registerModule( "Expand", function () { KityMinder.registerModule( "Expand", function () {
var minder = this;
var EXPAND_STATE_DATA = 'expandState', var EXPAND_STATE_DATA = 'expandState',
STATE_EXPAND = 'expand', STATE_EXPAND = 'expand',
STATE_COLLAPSE = 'collapse'; STATE_COLLAPSE = 'collapse';
...@@ -11,27 +12,71 @@ KityMinder.registerModule( "Expand", function () { ...@@ -11,27 +12,71 @@ KityMinder.registerModule( "Expand", function () {
_buffer.shift(); _buffer.shift();
} }
} }
//获取选中的最上层节点
var filterDuplicate = function ( nodes ) {
var _buffer = ( [] ).concat( nodes );
var resultSet = [];
for ( var i = 0; i < _buffer.length; i++ ) {
var parent = _buffer[ i ].getParent();
if ( !parent ) {
resultSet = [ _buffer[ i ] ];
break;
} else {
//筛选
while ( parent ) {
if ( _buffer.indexOf( parent ) !== -1 ) {
_buffer[ i ] = null;
break;
}
parent = parent.getParent();
}
if ( _buffer[ i ] ) resultSet.push( _buffer[ i ] );
}
}
return resultSet;
}
// var getCommonParents = function ( nodes ) { var expandAll = function ( km, deal ) {
// var _buffer = []; var selectedNodes = km.getSelectedNodes();
// var resultSet = []; var topNodes = filterDuplicate( selectedNodes );
// for ( var i = 0; i < nodes.length; i++ ) { if ( selectedNodes.length === 0 || selectedNodes[ 0 ].getType() === 'root' || topNodes[ 0 ].getType() === 'root' ) {
// _buffer.push( nodes[ i ] ); layerTravel( km.getRoot(), function ( n ) {
// } if ( deal === 'expand' ) n.expand();
// while ( _buffer.length !== 0 ) { else n.collapse();
// var parent = _buffer[ 0 ].getParent(); } );
// if ( parent.getType() === 'root' || _buffer.length === 1 ) { km.initStyle();
// resultSet.push( _buffer[ 0 ] ); } else {
// } else { for ( var i = 0; i < topNodes.length; i++ ) {
// if ( _buffer.indexOf( parent ) === -1 ) { var node = topNodes[ i ];
// _buffer.push( parent ); var children = node.getChildren();
// } if ( children.length === 0 ) {
// } continue;
// _buffer.shift(); } else {
// } layerTravel( node, function ( n ) {
// return resultSet; if ( n !== node ) {
// } if ( deal === 'expand' ) n.expand();
else n.collapse();
}
} );
var judge_val;
if ( deal === 'expand' ) {
judge_val = !node.isExpanded();
} else {
judge_val = node.isExpanded();
}
if ( judge_val ) {
km.expandNode( node );
} else {
km.expandNode( node );
km.expandNode( node );
}
}
}
}
for ( var j = 0; j < selectedNodes.length; j++ ) {
km.highlightNode( selectedNodes[ j ] );
}
}
// var setOptionValue = function ( root, layer, sub ) { // var setOptionValue = function ( root, layer, sub ) {
// var cur_layer = 1; // var cur_layer = 1;
...@@ -146,28 +191,7 @@ KityMinder.registerModule( "Expand", function () { ...@@ -146,28 +191,7 @@ KityMinder.registerModule( "Expand", function () {
return { return {
base: Command, base: Command,
execute: function ( km ) { execute: function ( km ) {
var selectedNodes = km.getSelectedNodes(); expandAll( km, 'expand' );
if ( selectedNodes.length === 0 || selectedNodes[ 0 ].getType() === 'root' ) {
layerTravel( km.getRoot(), function ( n ) {
n.expand();
} );
km.initStyle();
} else {
var selectedNode = km.getSelectedNode();
var children = selectedNode.getChildren();
if ( children.length === 0 ) {
return false;
}
layerTravel( selectedNode, function ( n ) {
if ( n !== selectedNode ) n.expand();
} );
if ( !selectedNode.isExpanded() ) {
km.expandNode( selectedNode );
} else {
km.expandNode( selectedNode );
km.expandNode( selectedNode );
}
}
}, },
queryState: function ( km ) { queryState: function ( km ) {
return 0; return 0;
...@@ -178,25 +202,7 @@ KityMinder.registerModule( "Expand", function () { ...@@ -178,25 +202,7 @@ KityMinder.registerModule( "Expand", function () {
return { return {
base: Command, base: Command,
execute: function ( km ) { execute: function ( km ) {
var selectedNodes = km.getSelectedNodes(); expandAll( km, 'collapse' );
if ( selectedNodes.length === 0 || selectedNodes[ 0 ].getType() === 'root' ) {
layerTravel( km.getRoot(), function ( n ) {
n.collapse();
} );
km.initStyle();
} else {
var selectedNode = km.getSelectedNode();
var children = selectedNode.getChildren();
if ( children.length === 0 ) {
return false;
}
if ( selectedNode.isExpanded() ) {
layerTravel( selectedNode, function ( n ) {
if ( n !== selectedNode ) n.collapse();
} );
km.expandNode( selectedNode );
}
}
}, },
queryState: function ( km ) { queryState: function ( km ) {
return 0; return 0;
......
...@@ -703,6 +703,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -703,6 +703,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
if ( focus ) { if ( focus ) {
showNodeInView( node ); showNodeInView( node );
} }
parent.expand();
var shicon = parent.getLayout().shicon; var shicon = parent.getLayout().shicon;
if ( shicon ) shicon.switchState( true ); if ( shicon ) shicon.switchState( true );
}, },
......
...@@ -27,21 +27,21 @@ var ViewDragger = kity.createClass( "ViewDragger", { ...@@ -27,21 +27,21 @@ var ViewDragger = kity.createClass( "ViewDragger", {
lastPosition = null, lastPosition = null,
currentPosition = null; currentPosition = null;
this._minder.on( 'normal.beforemousedown readonly.beforemousedown readonly.beforetouchstart', function ( e ) { this._minder.on( 'normal.mousedown readonly.mousedown readonly.touchstart', function ( e ) {
// 点击未选中的根节点临时开启 // 点击未选中的根节点临时开启
if ( e.getTargetNode() == this.getRoot() && if ( e.getTargetNode() == this.getRoot() &&
( !this.getRoot().isSelected() || !this.isSingleSelect() ) ) { ( !this.getRoot().isSelected() || !this.isSingleSelect() ) ) {
lastPosition = e.getPosition(); lastPosition = e.getPosition();
dragger.setEnabled( true );
isRootDrag = true; isRootDrag = true;
e.originEvent.preventDefault();
var me = this;
setTimeout( function () {
me.setStatus( 'hand' );
}, 1 );
} }
} ) } )
.on('normal.mousemove normal.touchmove', function (e) {
if (!isRootDrag) return;
var offset = kity.Vector.fromPoints( lastPosition, e.getPosition());
if (offset.length() > 3) this.setStatus( 'hand' );
})
.on( 'hand.beforemousedown hand.beforetouchend', function ( e ) { .on( 'hand.beforemousedown hand.beforetouchend', function ( e ) {
// 已经被用户打开拖放模式 // 已经被用户打开拖放模式
if ( dragger.isEnabled() ) { if ( dragger.isEnabled() ) {
...@@ -64,7 +64,7 @@ var ViewDragger = kity.createClass( "ViewDragger", { ...@@ -64,7 +64,7 @@ var ViewDragger = kity.createClass( "ViewDragger", {
} }
} ) } )
.on( 'hand.mouseup', function ( e ) { .on( 'mouseup', function ( e ) {
lastPosition = null; lastPosition = null;
// 临时拖动需要还原状态 // 临时拖动需要还原状态
......
...@@ -41,6 +41,9 @@ html, body, #kityminder, div.kmui-editor-body { ...@@ -41,6 +41,9 @@ html, body, #kityminder, div.kmui-editor-body {
/*line-height: 0;*/ /*line-height: 0;*/
overflow: hidden; overflow: hidden;
} }
svg { svg, body {
font-family: Arial, "Microsoft Yahei","Heiti SC",sans-serif; font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif;
} }
\ No newline at end of file #about{position:absolute;bottom:10px;right:10px;height:24px;line-height:24px;color:#888;font-family:Arial;font-size:13px;font-weight:normal;margin:0;text-shadow:0 1px 1px #000}#about a{color:#888}#about a:hover{color:#fff}
#km-version.new-version{position:relative;padding-right:30px}
#km-version.new-version:after{content:'NEW';color:#ff0;position:absolute;top:-10px;right:-5px;display:block;background:#f00;padding:0 5px;border-radius:4px;text-shadow:none;box-shadow:-1px 1px 3px rgba(0,0,0,0.3);-webkit-transform:scale(.6);-moz-transform:scale(.6);-ms-transform:scale(.6);transform:scale(.6)}
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