Commit 79881238 authored by techird's avatar techird

Merge pull request #100 from fex-team/release-1.2.0

Release 1.2.0
parents 9a2f191c 3e04f19a
...@@ -5,7 +5,7 @@ Kity Minder ...@@ -5,7 +5,7 @@ Kity Minder
KityMinder 是百度 FEX 团队的 f-cube 小组(原 UEditor 小组)的又一力作。作为一款在线的脑图编辑工具,它有着不亚于 native 脑图工具的交互体验。同时,它充分发挥了 Web 云存储的优势,可以直接将编辑中的脑图同步到云端。此外,借由独创的 “云盘分享”功能,用户可以一键将当前编辑的脑图直接生成在线链接共享给其他用户,实现无缝沟通。 KityMinder 是百度 FEX 团队的 f-cube 小组(原 UEditor 小组)的又一力作。作为一款在线的脑图编辑工具,它有着不亚于 native 脑图工具的交互体验。同时,它充分发挥了 Web 云存储的优势,可以直接将编辑中的脑图同步到云端。此外,借由独创的 “云盘分享”功能,用户可以一键将当前编辑的脑图直接生成在线链接共享给其他用户,实现无缝沟通。
![KityMinder](summary.jpg "KityMinder 界面") ![KityMinder](snap.png "KityMinder 界面")
KityMinder 基于 SVG 技术实现,支持绝大多数的主流浏览器,包括: KityMinder 基于 SVG 技术实现,支持绝大多数的主流浏览器,包括:
......
...@@ -21,10 +21,10 @@ if (isset($_REQUEST['content'])) { ...@@ -21,10 +21,10 @@ if (isset($_REQUEST['content'])) {
$filename = "kikyminder"; $filename = "kikyminder";
} }
header("Content-type: application/octet-stream; charset=utf-8; name=".$filename); header("Content-type: application/octet-stream; charset=utf8; name=".urlencode($filename));
header("Accept-Length: ".strlen($content)); header("Accept-Length: ".strlen($content));
header("Content-Length: ".strlen($content)); header("Content-Length: ".strlen($content));
header("Content-Disposition: attachment; filename=".$filename); header("Content-Disposition: attachment; filename=".urlencode($filename));
header('Content-Description: File Transfer'); header('Content-Description: File Transfer');
echo $content; echo $content;
......
...@@ -2,30 +2,31 @@ ...@@ -2,30 +2,31 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="title" content="百度脑图"> <meta name="title" content="百度脑图(KityMinder)">
<meta name="keyword" content="图,kity,svg,minder,百度,fex,前端,在线"> <meta name="keyword" content="kityminder,脑图,思维导图,kity,svg,minder,百度,fex,前端,在线">
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。"> <meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="lib/jquery-2.1.0.min.js?_=1404368767190" charset="utf-8"></script> <script src="lib/jquery-2.1.0.min.js?_=1404922397905" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1404368767190" charset="utf-8"></script> <script src="lib/ZeroClipboard.min.js?_=1404922397905" 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/kity.min.js?_=1404368767190" charset="utf-8"></script> <script src="lib/kity.min.js?_=1404922397905" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1404368767190" charset="utf-8"></script> <script src="kityminder.all.min.js?_=1404922397905" charset="utf-8"></script>
<script src="kityminder.config.js?_=1404368767190" charset="utf-8"></script> <script src="kityminder.config.js?_=1404922397905" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1404368767190" charset="utf-8"></script> <script src="lang/zh-cn/zh-cn.js?_=1404922397905" charset="utf-8"></script>
<script src="lib/zip.js?_=1404368767190" charset="utf-8"></script> <script src="lib/zip.js?_=1404922397905" charset="utf-8"></script>
<script> <script>
zip.inflateJSPath = 'lib/inflate.js'; zip.inflateJSPath = 'lib/inflate.js';
</script> </script>
<script src="lib/jquery.xml2json.js?_=1404368767190" charset="utf-8"></script> <script src="lib/jquery.xml2json.js?_=1404922397905" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1404368767190" charset="utf-8"></script> <script src="lib/baidu-frontia-js-full-1.0.0.js?_=1404922397905" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1404368767190" charset="utf-8"></script> <script src="social/draftmanager.js?_=1404922397905" charset="utf-8"></script>
<script src="social/social.js?_=1404368767190" charset="utf-8"></script> <script src="social/social.js?_=1404922397905" 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" />
...@@ -34,11 +35,12 @@ ...@@ -34,11 +35,12 @@
</head> </head>
<body> <body>
<div id="content-wrapper">
<div id="panel"></div> <div id="panel"></div>
<div id="kityminder" onselectstart="return false"></div> <div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" > <div id="share-dialog">
<h3>URL分享:</h3> <h3>URL分享:</h3>
<p> <p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" /> <input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
...@@ -94,6 +96,7 @@ ...@@ -94,6 +96,7 @@
target="_blank">Contact Us target="_blank">Contact Us
</a> </a>
</div> </div>
</div>
</body> </body>
<!--脑图启动代码--> <!--脑图启动代码-->
...@@ -114,16 +117,20 @@ ...@@ -114,16 +117,20 @@
}); });
km.on('unziperror', function(ev) { km.on('unziperror', function(ev) {
alert('unziperror'); alert('文件解析错误,文件可能已损坏!');
}); });
km.on('parseerror', function(ev) { km.on('parseerror', function(ev) {
alert('parseerror'); alert('文件解析错误,文件可能已损坏!');
}); });
km.on('unknownprotocal', function(ev) { km.on('unknownprotocal', function(ev) {
alert('unknownprotocal'); alert('不支持的文件格式!');
}); });
document.body.ontouchmove = function(e) {
//e.preventDefault();
}
</script> </script>
<!--社会分享代码--> <!--社会分享代码-->
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
KityMinder.LANG['zh-cn'] = { KityMinder.LANG['zh-cn'] = {
'template': { 'template': {
'default': '思维导图', 'default': '思维导图',
'structure': '组织结构图' 'structure': '组织结构图',
'filetree': '文件夹'
}, },
'theme': { 'theme': {
'classic': '脑图经典', 'classic': '脑图经典',
...@@ -28,16 +29,15 @@ KityMinder.LANG['zh-cn'] = { ...@@ -28,16 +29,15 @@ KityMinder.LANG['zh-cn'] = {
'saveto': '另存为', 'saveto': '另存为',
'hand': '允许拖拽', 'hand': '允许拖拽',
'zoom': '放大缩小', 'zoom': '放大缩小',
'markers': '添加标签', 'markers': '标签',
'resource': '分配资源', 'resource': '资源',
'switchlayout': '切换主题',
'help': '帮助', 'help': '帮助',
'preference': '偏好设置', 'preference': '偏好设置',
'image': '插入图片', 'image': '插入图片',
'hyperlink': '插入链接', 'hyperlink': '插入链接',
'unhyperlink': '删除链接', 'unhyperlink': '删除链接',
'expandnode': '展开节点', 'expandnode': '展开到叶子',
'collapsenode': '收起节点', 'collapsenode': '收起到一级节点',
'template': '模板', 'template': '模板',
'theme': '皮肤' 'theme': '皮肤'
}, },
...@@ -58,14 +58,14 @@ KityMinder.LANG['zh-cn'] = { ...@@ -58,14 +58,14 @@ KityMinder.LANG['zh-cn'] = {
'none': '无', 'none': '无',
'progress': { 'progress': {
'title': '进度', 'title': '进度',
'notdone': "未完成", 'notdone': '未完成',
'done1': '完成1/8', 'done1': '完成 1/8',
'done2': '完成1/4', 'done2': '完成 1/4',
'done3': '完成3/8', 'done3': '完成 3/8',
'done4': '完成1/2', 'done4': '完成 1/2',
'done5': '完成5/8', 'done5': '完成 5/8',
'done6': '完成3/4', 'done6': '完成 3/4',
'done7': '完成7/8', 'done7': '完成 7/8',
'done': '已完成' 'done': '已完成'
} }
}, },
...@@ -77,28 +77,24 @@ KityMinder.LANG['zh-cn'] = { ...@@ -77,28 +77,24 @@ KityMinder.LANG['zh-cn'] = {
'resource': {} 'resource': {}
}, },
'node': { 'node': {
'appendsiblingnode': '插入同级节点', 'appendsiblingnode': '插入兄弟节点',
'appendchildnode': '插入子节点', 'appendchildnode': '插入子节点',
'removenode': '删除节点', 'removenode': '删除',
'editnode': '编辑节点' 'editnode': '编辑'
},
'layout': {
'default': '左右展开',
'bottom': '向下展开'
}, },
'hyperlink': { 'hyperlink': {
'hyperlink': '插入超链接', 'hyperlink': '链接...',
'unhyperlink': '取消超链接' 'unhyperlink': '移除链接'
}, },
'image': { 'image': {
'image': '插入图片', 'image': '图片...',
'removeimage': '除图片' 'removeimage': '除图片'
}, },
'marker': { 'marker': {
'marker': '进度/优先级' 'marker': '进度/优先级...'
}, },
'resource': { 'resource': {
'resource': '分配资源' 'resource': '资源...'
} }
}; };
\ No newline at end of file
/*! /*!
* ==================================================== * ====================================================
* kity - v2.0.0 - 2014-07-01 * kity - v2.0.0 - 2014-07-08
* https://github.com/fex-team/kity * https://github.com/fex-team/kity
* GitHub: https://github.com/fex-team/kity.git * GitHub: https://github.com/fex-team/kity.git
* Copyright (c) 2014 Baidu FEX; Licensed BSD * Copyright (c) 2014 Baidu FEX; Licensed BSD
...@@ -2984,7 +2984,7 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph ...@@ -2984,7 +2984,7 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph
* 转换后的 PathSegment,每一段都是 'C' * 转换后的 PathSegment,每一段都是 'C'
*/ */
g.pathToCurve = cacher(function(path) { g.pathToCurve = cacher(function(path) {
var i, command, param; var i, j, command, param;
var initPoint, currentPoint, endPoint, shouldClose, lastControlPoint, aussumedControlPoint; var initPoint, currentPoint, endPoint, shouldClose, lastControlPoint, aussumedControlPoint;
var controlPoint1, controlPoint2; var controlPoint1, controlPoint2;
var res = []; var res = [];
...@@ -3054,12 +3054,21 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph ...@@ -3054,12 +3054,21 @@ define("graphic/geometry", [ "core/utils", "graphic/point", "core/class", "graph
case "A": case "A":
param = a2c.apply(null, currentPoint.concat(param)); param = a2c.apply(null, currentPoint.concat(param));
controlPoint1 = param.slice(0, 2); j = 0;
controlPoint2 = param.slice(2, 4); while (j in param) {
controlPoint1 = param.slice(j, j + 2);
controlPoint2 = param.slice(j + 2, j + 4);
endPoint = param.slice(j + 4, j + 6);
// 写入当前一段曲线
res.push([ "C" ].concat(controlPoint1).concat(controlPoint2).concat(endPoint));
j += 6;
}
break; break;
} }
// 写入当前一段曲线 if (command != "A") {
res.push([ "C" ].concat(controlPoint1).concat(controlPoint2).concat(endPoint)); // 写入当前一段曲线
res.push([ "C" ].concat(controlPoint1).concat(controlPoint2).concat(endPoint));
}
// 为下次循环准备当前位置 // 为下次循环准备当前位置
currentPoint = endPoint; currentPoint = endPoint;
// 二次贝塞尔曲线自己已经记录了上个控制点的位置,其它的记录控制点 2 的位置 // 二次贝塞尔曲线自己已经记录了上个控制点的位置,其它的记录控制点 2 的位置
...@@ -5931,6 +5940,7 @@ define("graphic/textcontent", [ "graphic/shape", "graphic/svg", "core/utils", "g ...@@ -5931,6 +5940,7 @@ define("graphic/textcontent", [ "graphic/shape", "graphic/svg", "core/utils", "g
// call shape constructor // call shape constructor
this.callBase(nodeType); this.callBase(nodeType);
this.shapeNode = this.shapeNode || this.node; this.shapeNode = this.shapeNode || this.node;
this.shapeNode.setAttribute("text-rendering", "geometricPrecision");
}, },
clearContent: function() { clearContent: function() {
while (this.shapeNode.firstChild) { while (this.shapeNode.firstChild) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
.niceblue{color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);} .niceblue{color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}
.dropdown{padding-right:28px;position:relative}.dropdown:after{content:' ';display:block;position:absolute;right:10px;top:12px;width:0;height:0;border:solid;border-width:4px 5px;border-color:#333 transparent transparent transparent} .dropdown{padding-right:28px;position:relative}.dropdown:after{content:' ';display:block;position:absolute;right:10px;top:12px;width:0;height:0;border:solid;border-width:4px 5px;border-color:#333 transparent transparent transparent}
.dropdown:active:after,.dropdown.active:after{border-color:#fff transparent transparent transparent} .dropdown:active:after,.dropdown.active:after{border-color:#fff transparent transparent transparent}
button{font-family:Arial,"Heiti SC","Microsoft Yahei";outline:none;display:inline-block;vertical-align:middle;/* font-size: 12px; */padding:0 15px;height:30px;font-size: 12px;line-height:30px;text-align:center;color:#000;text-decoration:none;border:none;margin-left:5px;background:none;border-radius: 0px;color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}button:hover,button.hover{background:#009fff} button{font-family:Arial,"Heiti SC","Microsoft Yahei";outline:none;display:inline-block;vertical-align:middle;padding:0 15px;height:30px;font-size:13px;line-height:30px;text-align:center;color:#000;text-decoration:none;border:none;margin-left:5px;background:none;color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}button:hover,button.hover{background:#009fff}
button:active,button.active{background:#007fcc;box-shadow:inset 0 2px 3px rgba(0,0,0,0.2)} button:active,button.active{background:#007fcc;box-shadow:inset 0 2px 3px rgba(0,0,0,0.2)}
button[disabled]{cursor:default;background:#ccc} button[disabled]{cursor:default;background:#ccc}
.draft-menu.kmui-dropdown-menu{margin-top:24px;margin-left:1px}.draft-menu.kmui-dropdown-menu span.update-time{float:right;color:#ccc;margin-left:20px;padding-right:16px} .draft-menu.kmui-dropdown-menu{margin-top:24px;margin-left:1px}.draft-menu.kmui-dropdown-menu span.update-time{float:right;color:#ccc;margin-left:40px;padding-right:16px}
.draft-menu.kmui-dropdown-menu li.draft-item a{position:relative}.draft-menu.kmui-dropdown-menu li.draft-item a:before{content:' ';display:block;width:24px;height:24px;background:url(../themes/default/images/draft.png) no-repeat 0 -24px;position:absolute;left:4px;top:2px} .draft-menu.kmui-dropdown-menu li.draft-item a{position:relative}.draft-menu.kmui-dropdown-menu li.draft-item a:before{content:' ';display:block;width:24px;height:24px;background:url(../themes/default/images/draft.png) no-repeat 0 -24px;position:absolute;left:4px;top:2px}
.draft-menu.kmui-dropdown-menu li.draft-item:hover a:before{background-position:0 -48px} .draft-menu.kmui-dropdown-menu li.draft-item:hover a:before{background-position:0 -48px}
.draft-menu.kmui-dropdown-menu li.draft-item{position:relative}.draft-menu.kmui-dropdown-menu li.draft-item:hover a.delete{display:block} .draft-menu.kmui-dropdown-menu li.draft-item{position:relative}.draft-menu.kmui-dropdown-menu li.draft-item:hover a.delete{display:block}
...@@ -13,13 +13,13 @@ button[disabled]{cursor:default;background:#ccc} ...@@ -13,13 +13,13 @@ button[disabled]{cursor:default;background:#ccc}
.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked{overflow:hidden;opacity:1;color:#ccc}.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-icon{float:left;margin:5px 0;width:28px;background-position:center 0;opacity:.3} .draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked{overflow:hidden;opacity:1;color:#ccc}.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-icon{float:left;margin:5px 0;width:28px;background-position:center 0;opacity:.3}
.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-item-label{display:block;margin-left:28px} .draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-item-label{display:block;margin-left:28px}
.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked:hover{color:#ccc}.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked:hover .kmui-combobox-icon{background-position:center 0} .draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked:hover{color:#ccc}.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked:hover .kmui-combobox-icon{background-position:center 0}
.file-menu.kmui-dropdown-menu{margin-top:24px;margin-left:1px;border-radius:4px;box-shadow:0 1px 5px rgba(0,0,0,0.3)}.file-menu.kmui-dropdown-menu #save-button,.file-menu.kmui-dropdown-menu #manage-file-button{display:none} .file-menu.kmui-dropdown-menu{margin-top:24px;margin-left:1px;box-shadow:0 1px 5px rgba(0,0,0,0.3)}.file-menu.kmui-dropdown-menu #save-button,.file-menu.kmui-dropdown-menu #manage-file-button{display:none}
.file-menu.kmui-dropdown-menu.logined #save-button,.file-menu.kmui-dropdown-menu.logined #manage-file-button{display:block} .file-menu.kmui-dropdown-menu.logined #save-button,.file-menu.kmui-dropdown-menu.logined #manage-file-button{display:block}
.file-menu.kmui-dropdown-menu.logined #net-hint-buttom{display:none} .file-menu.kmui-dropdown-menu.logined #net-hint-buttom{display:none}
.user-menu.kmui-dropdown-menu{margin-top:24px;margin-left:-25px;min-width:130px;border-radius:4px;box-shadow:0 1px 5px rgba(0,0,0,0.3)}.user-menu.kmui-dropdown-menu li a{padding-left:40px} .user-menu.kmui-dropdown-menu{margin-top:24px;margin-left:-25px;min-width:130px;box-shadow:0 1px 5px rgba(0,0,0,0.3)}.user-menu.kmui-dropdown-menu li a{padding-left:40px}
#share-dialog{position:absolute;padding:20px;border-radius:4px;left:50%;top:40%;margin-left:-175px;margin-top:-100px;background:#fff;width:350px;box-shadow:1px 2px 16px rgba(0,0,0,0.5);display:none}#share-dialog h3{margin:0;font-size:16px;color:#666} #share-dialog{position:absolute;padding:20px;left:50%;top:40%;margin-left:-175px;margin-top:-100px;background:#fff;width:350px;box-shadow:1px 2px 16px rgba(0,0,0,0.5);display:none}#share-dialog h3{margin:0;font-size:16px;color:#666}
#share-dialog input{width:260px;height:22px;line-height:22px;padding:4px 4px 0;border:1px solid #999;vertical-align:middle;margin-right:3px;background:#eee}#share-dialog input:focus{border:1px solid #99f;outline:none} #share-dialog input{width:255px;height:22px;line-height:22px;padding:4px 4px 0;border:1px solid #999;vertical-align:middle;margin-right:3px;background:#eee}#share-dialog input:focus{border:1px solid #99f;outline:none}
#share-dialog p,#share-dialog #share-platform{margin:20px 0 30px} #share-dialog p,#share-dialog #share-platform{margin:20px 0 30px}
#share-dialog #copy-share-url{display:inline-block;margin:0;width:70px;height:28px;line-height:28px;border-radius:2px;vertical-align:middle;border-radius:5px;color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}#share-dialog #copy-share-url:hover,#share-dialog #copy-share-url.hover{background:#009fff} #share-dialog #copy-share-url{display:inline-block;margin:0;width:75px;height:28px;line-height:28px;vertical-align:middle;color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}#share-dialog #copy-share-url:hover,#share-dialog #copy-share-url.hover{background:#009fff}
#share-dialog #copy-share-url:active,#share-dialog #copy-share-url.active{background:#007fcc;box-shadow:inset 0 2px 3px rgba(0,0,0,0.2)} #share-dialog #copy-share-url:active,#share-dialog #copy-share-url.active{background:#007fcc;box-shadow:inset 0 2px 3px rgba(0,0,0,0.2)}
#share-dialog #share-platform{margin-bottom:0} #share-dialog #share-platform{margin-bottom:0}
{"version":3,"file":"social.css","sources":["social.less"],"names":[],"mappings":"AAAA;EACI,YAAA;EACA,YAAY,+DAAZ;;EACA,YAAY,gDAAgD,yBAAwB,yBAAwB,0BAA5G;;EACA,YAAY,kEAAZ;;EACA,YAAY,6DAAZ;;EACA,YAAY,8DAAZ;;EACA,YAAY,gEAAZ;;;AAGJ;EACI,mBAAA;EACA,kBAAA;;AACA,SAAC;EACG,SAAS,GAAT;EACA,cAAA;EACA,kBAAA;EACA,WAAA;EACA,SAAA;EACA,QAAA;EACA,SAAA;EACA,aAAA;EACA,qBAAA;EACA,sDAAA;;AAGA,SADH,OACI;AAAD,SADO,OACN;EACG,sDAAA;;AAKZ;EACI,oBAAoB,YAAY,iBAAhC;EACA,aAAA;EACA,qBAAA;EACA,sBAAA;EACA,eAAA;EACA,YAAA;EACA,eAAA;EACA,iBAAA;EACA,kBAAA;EACA,WAAA;EACA,qBAAA;EACA,YAAA;EACA,gBAAA;EACA,gBAAA;EA7CA,YAAA;EACA,YAAY,+DAAZ;;EACA,YAAY,gDAAgD,yBAAwB,yBAAwB,0BAA5G;;EACA,YAAY,kEAAZ;;EACA,YAAY,6DAAZ;;EACA,YAAY,8DAAZ;;EACA,YAAY,gEAAZ;;;AA2CA,MAAC;AAAQ,MAAC;EACN,mBAAA;;AAGJ,MAAC;AAAS,MAAC;EACP,mBAAA;EACA,8CAAA;;AAGJ,MAAC;EACG,eAAA;EACA,gBAAA;;AAIR,WAAW;EACP,gBAAA;EACA,gBAAA;;AAFJ,WAAW,mBAGP,KAAI;EACA,YAAA;EACA,WAAA;EACA,iBAAA;EACA,mBAAA;;AAPR,WAAW,mBASP,GAAE,WAAY;EACV,kBAAA;;AACA,WAXG,mBASP,GAAE,WAAY,EAET;EACG,SAAS,GAAT;EACA,cAAA;EACA,WAAA;EACA,YAAA;EACA,qEAAA;EACA,kBAAA;EACA,SAAA;EACA,QAAA;;AAnBZ,WAAW,mBAsBP,GAAE,WAAW,MAAO,EAAC;EACjB,4BAAA;;AAvBR,WAAW,mBAyBP,GAAE;EACE,kBAAA;;AACA,WA3BG,mBAyBP,GAAE,WAEG,MAAO,EAAC;EACL,cAAA;;AA5BZ,WAAW,mBAyBP,GAAE,WAKE,EAAC;EACG,aAAA;EACA,eAAA;EACA,kBAAA;EACA,WAAA;EACA,YAAA;EACA,UAAA;EACA,QAAA;EACA,UAAA;EACA,wEAAA;;AACA,WAxCD,mBAyBP,GAAE,WAKE,EAAC,OAUI;EACG,aAAA;;AAEJ,WA3CD,mBAyBP,GAAE,WAKE,EAAC,OAaI;EACG,4BAAA;;AAIZ,WAhDO,mBAgDN,mBAAoB;EACjB,gBAAA;EACA,UAAA;EACA,WAAA;;AAHJ,WAhDO,mBAgDN,mBAAoB,uBAIjB;EACI,WAAA;EACA,aAAA;EACA,WAAA;EACA,6BAAA;EACA,WAAA;;AATR,WAhDO,mBAgDN,mBAAoB,uBAWjB;EACI,cAAA;EACA,iBAAA;;AAEJ,WA/DG,mBAgDN,mBAAoB,uBAehB;EACG,WAAA;;AADJ,WA/DG,mBAgDN,mBAAoB,uBAehB,MAEG;EACI,6BAAA;;AAMhB,UAAU;EACN,gBAAA;EACA,gBAAA;EACA,0CAAA;;AAHJ,UAAU,mBAKN;AALJ,UAAU,mBAKQ;EACV,aAAA;;AAGJ,UATM,mBASL,QACG;AADJ,UATM,mBASL,QACiB;EACV,cAAA;;AAFR,UATM,mBASL,QAIG;EACI,aAAA;;AAIZ,UAAU;EACN,gBAAA;EACA,kBAAA;EACA,gBAAA;EACA,0CAAA;;AAJJ,UAAU,mBAMN,GAAG;EACC,kBAAA;;AAIR;EACI,kBAAA;EACA,aAAA;EACA,SAAA;EACA,QAAA;EACA,mBAAA;EACA,kBAAA;EACA,iBAAA;EACA,YAAA;EACA,2CAAA;EACA,aAAA;;AAVJ,aAYI;EACI,SAAA;EACA,eAAA;EACA,WAAA;;AAfR,aAkBI;EACI,YAAA;EACA,YAAA;EACA,iBAAA;EACA,kBAAA;EACA,sBAAA;EACA,sBAAA;EACA,iBAAA;EACA,gBAAA;;AACA,aATJ,MASK;EACG,sBAAA;EACA,aAAA;;AA7BZ,aAiCI;AAjCJ,aAiCO;EACC,mBAAA;;AAlCR,aAqCI;EACI,qBAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA;EACA,iBAAA;EACA,sBAAA;EAhNJ,YAAA;EACA,YAAY,+DAAZ;;EACA,YAAY,gDAAgD,yBAAwB,yBAAwB,0BAA5G;;EACA,YAAY,kEAAZ;;EACA,YAAY,6DAAZ;;EACA,YAAY,8DAAZ;;EACA,YAAY,gEAAZ;;;AAgNI,aAZJ,gBAYK;AAAQ,aAZb,gBAYc;EACN,mBAAA;;AAGJ,aAhBJ,gBAgBK;AAAS,aAhBd,gBAgBe;EACP,mBAAA;EACA,8CAAA;;AAvDZ,aA4DI;EACI,gBAAA"}
\ No newline at end of file
...@@ -86,7 +86,12 @@ $(function() { ...@@ -86,7 +86,12 @@ $(function() {
notice = (function() { notice = (function() {
return window.alert; return window.alert;
})(); })(),
wordLimit = function(word, limit) {
limit = limit || 15;
return word.length > limit ? (word.substr(0, limit - 3) + '...') : word;
};
start(); start();
...@@ -105,7 +110,7 @@ $(function() { ...@@ -105,7 +110,7 @@ $(function() {
function createFileMenu() { function createFileMenu() {
var menus = [{ var menus = [{
label: '新建 (Ctrl + N)', label: '新建',
click: newFile click: newFile
}, { }, {
divider: true divider: true
...@@ -119,16 +124,24 @@ $(function() { ...@@ -119,16 +124,24 @@ $(function() {
acceptFiles.push(p.fileExtension); acceptFiles.push(p.fileExtension);
} }
}); });
menus = menus.concat([{
label: '导入本地文件', function importUseEncoding(encoding) {
click: function() { return function() {
$('<input type="file" />') $('<input type="file" />')
.attr('accept', acceptFiles.join(',')) .attr('accept', acceptFiles.join(','))
.on('change', function(e) { .on('change', function(e) {
e = e.originalEvent; e = e.originalEvent;
minder.importFile(e.target.files[0]); minder.importFile(e.target.files[0], encoding);
}).click(); }).click();
} };
}
menus = menus.concat([{
label: '导入...',
click: importUseEncoding('utf8')
}, {
label: '以 GBK 编码导入...',
click: importUseEncoding('gbk')
}, { }, {
divider: true divider: true
}]); }]);
...@@ -150,7 +163,7 @@ $(function() { ...@@ -150,7 +163,7 @@ $(function() {
menus = menus.concat([{ menus = menus.concat([{
divider: true, divider: true,
}, { }, {
label: '登陆', label: '请登录',
click: login, click: login,
id: 'net-hint-buttom' id: 'net-hint-buttom'
}, { }, {
...@@ -174,7 +187,9 @@ $(function() { ...@@ -174,7 +187,9 @@ $(function() {
$file_btn = $('<button id="file-btn">文件</button>').addClass('dropdown').appendTo($menu); $file_btn = $('<button id="file-btn">文件</button>').addClass('dropdown').appendTo($menu);
$file_menu = $.kmuidropmenu({ data: createFileMenu() }) $file_menu = $.kmuidropmenu({
data: createFileMenu()
})
.addClass('file-menu') .addClass('file-menu')
.appendTo('body'); .appendTo('body');
...@@ -234,6 +249,10 @@ $(function() { ...@@ -234,6 +249,10 @@ $(function() {
e.stopPropagation(); e.stopPropagation();
}); });
$('body').delegate('#global-zeroclipboard-html-bridge', 'mousedown', function(e) {
e.stopPropagation();
});
var copyTrickTimer = 0; var copyTrickTimer = 0;
$('body').on('mousedown', function(e) { $('body').on('mousedown', function(e) {
copyTrickTimer = setTimeout(function() { copyTrickTimer = setTimeout(function() {
...@@ -333,19 +352,14 @@ $(function() { ...@@ -333,19 +352,14 @@ $(function() {
function setRemotePath(path, saved) { function setRemotePath(path, saved) {
var filename; var filename;
remotePath = path; remotePath = path;
if (remotePath) {
filename = getFileName(remotePath);
if (!saved) {
filename = '* ' + filename;
}
$title.text(filename);
} else if (currentAccount) {
$title.text('* ' + minder.getMinderTitle());
} else {
$title.text(filename || minder.getMinderTitle());
}
document.title = [filename || minder.getMinderTitle(), titleSuffix].join(' - '); filename = remotePath ? getFileName(remotePath) : minder.getMinderTitle();
if (!saved) filename = '* ' + filename;
$title.text(filename)
document.title = [filename, titleSuffix].join(' - ');
} }
// 检查是否在 Cookie 中登录过了 // 检查是否在 Cookie 中登录过了
...@@ -432,7 +446,7 @@ $(function() { ...@@ -432,7 +446,7 @@ $(function() {
addToRecentMenu(result.list.filter(function(file) { addToRecentMenu(result.list.filter(function(file) {
return getFileFormat(file.path) in fileLoader; return getFileFormat(file.path) in fileLoader;
})); }));
syncPreference(result.list); //syncPreference(result.list);
} }
}, },
error: loadUserFiles error: loadUserFiles
...@@ -712,13 +726,26 @@ $(function() { ...@@ -712,13 +726,26 @@ $(function() {
minder.execCommand('camera', minder.getRoot(), 300); minder.execCommand('camera', minder.getRoot(), 300);
} }
function generateRemotePath() { function generateRemotePath(filename) {
var filename = window.prompt("请输入文件名: ", minder.getMinderTitle()) || minder.getMinderTitle();
return '/apps/kityminder/' + filename + '.km'; return '/apps/kityminder/' + filename + '.km';
} }
function save() { function save() {
if (!currentAccount || save.busy) return; if (!currentAccount) return alert('请先登录!');
if (save.busy) {
return;
}
var uploadPath, filename;
// 确定上传文件名
if (!remotePath) {
filename = window.prompt('请输入文件名: ', minder.getMinderTitle());
if (!filename) return;
uploadPath = generateRemotePath(filename);
} else {
uploadPath = remotePath;
}
save.busy = true; save.busy = true;
...@@ -745,7 +772,7 @@ $(function() { ...@@ -745,7 +772,7 @@ $(function() {
upload.tryCount = 0; upload.tryCount = 0;
return; return;
} }
var uploadPath = remotePath || generateRemotePath();
$title.loading('正在保存 “' + getFileName(uploadPath) + '” ...'); $title.loading('正在保存 “' + getFileName(uploadPath) + '” ...');
sto.uploadTextFile(data, uploadPath, { sto.uploadTextFile(data, uploadPath, {
ondup: remotePath ? sto.constant.ONDUP_OVERWRITE : sto.constant.ONDUP_NEWCOPY, ondup: remotePath ? sto.constant.ONDUP_OVERWRITE : sto.constant.ONDUP_NEWCOPY,
...@@ -840,16 +867,20 @@ $(function() { ...@@ -840,16 +867,20 @@ $(function() {
switch (keyCode) { switch (keyCode) {
//保存 //保存
case KM.keymap.s: case KM.keymap.s:
e.preventDefault();
if (e.shiftKey) { if (e.shiftKey) {
share(); share();
} else { } else {
save(); setTimeout(function() {
save();
});
} }
e.preventDefault();
break; break;
case KM.keymap.n: case KM.keymap.n:
newFile();
e.preventDefault(); e.preventDefault();
setTimeout(function() {
newFile();
});
break; break;
} }
} }
...@@ -861,9 +892,7 @@ $(function() { ...@@ -861,9 +892,7 @@ $(function() {
minder.on('contentchange', function() { minder.on('contentchange', function() {
if (!watchingChanges || lastContent == minder.exportData('json')) return; if (!watchingChanges || lastContent == minder.exportData('json')) return;
var current = draftManager.save(); var current = draftManager.save();
if (currentAccount) { setRemotePath(remotePath, current.sync);
setRemotePath(remotePath, current.sync);
}
lastContent = minder.exportData('json'); lastContent = minder.exportData('json');
}); });
} }
...@@ -882,7 +911,7 @@ $(function() { ...@@ -882,7 +911,7 @@ $(function() {
$draft_menu.append('<li disabled="disabled" class="current-draft kmui-combobox-item kmui-combobox-item-disabled kmui-combobox-checked">' + $draft_menu.append('<li disabled="disabled" class="current-draft kmui-combobox-item kmui-combobox-item-disabled kmui-combobox-checked">' +
'<span class="kmui-combobox-icon"></span>' + '<span class="kmui-combobox-icon"></span>' +
'<label class="kmui-combobox-item-label">' + '<label class="kmui-combobox-item-label">' +
'<span class="update-time">' + getFriendlyTimeSpan(+new Date(draft.update), +new Date()) + '</span>' + draft.name + '<span class="update-time">' + getFriendlyTimeSpan(+new Date(draft.update), +new Date()) + '</span>' + wordLimit(draft.name) +
'</label>' + '</label>' +
'</li>'); '</li>');
$draft_menu.append('<li class="kmui-divider"></li>'); $draft_menu.append('<li class="kmui-divider"></li>');
...@@ -894,7 +923,7 @@ $(function() { ...@@ -894,7 +923,7 @@ $(function() {
while (list.length) { while (list.length) {
draft = list.shift(); draft = list.shift();
$draft = $('<li class="draft-item">' + $draft = $('<li class="draft-item">' +
'<a href="#">' + '<span class="update-time">' + getFriendlyTimeSpan(+new Date(draft.update), +new Date()) + '</span>' + draft.name + '</a><a class="delete" title="删除该草稿"></a></li>'); '<a href="#">' + '<span class="update-time">' + getFriendlyTimeSpan(+new Date(draft.update), +new Date()) + '</span>' + wordLimit(draft.name) + '</a><a class="delete" title="删除该草稿"></a></li>');
$draft.data('draft-index', index++); $draft.data('draft-index', index++);
$draft.appendTo($draft_menu); $draft.appendTo($draft_menu);
} }
......
...@@ -45,7 +45,6 @@ button { ...@@ -45,7 +45,6 @@ button {
border: none; border: none;
margin-left: 5px; margin-left: 5px;
background: none; background: none;
border-radius: 2px;
.niceblue; .niceblue;
...@@ -70,7 +69,7 @@ button { ...@@ -70,7 +69,7 @@ button {
span.update-time { span.update-time {
float: right; float: right;
color: #CCC; color: #CCC;
margin-left: 20px; margin-left: 40px;
padding-right: 16px; padding-right: 16px;
} }
li.draft-item a { li.draft-item a {
...@@ -139,7 +138,6 @@ button { ...@@ -139,7 +138,6 @@ button {
.file-menu.kmui-dropdown-menu { .file-menu.kmui-dropdown-menu {
margin-top: 24px; margin-top: 24px;
margin-left: 1px; margin-left: 1px;
border-radius: 4px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3); box-shadow: 0px 1px 5px rgba(0,0,0, .3);
#save-button, #manage-file-button { #save-button, #manage-file-button {
...@@ -159,7 +157,6 @@ button { ...@@ -159,7 +157,6 @@ button {
margin-top: 24px; margin-top: 24px;
margin-left: -25px; margin-left: -25px;
min-width: 130px; min-width: 130px;
border-radius: 4px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3); box-shadow: 0px 1px 5px rgba(0,0,0, .3);
li a { li a {
...@@ -170,7 +167,6 @@ button { ...@@ -170,7 +167,6 @@ button {
#share-dialog { #share-dialog {
position: absolute; position: absolute;
padding: 20px; padding: 20px;
border-radius: 4px;
left: 50%; left: 50%;
top: 40%; top: 40%;
margin-left: -175px; margin-left: -175px;
...@@ -187,7 +183,7 @@ button { ...@@ -187,7 +183,7 @@ button {
} }
input { input {
width: 260px; width: 255px;
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
padding: 4px 4px 0; padding: 4px 4px 0;
...@@ -208,14 +204,12 @@ button { ...@@ -208,14 +204,12 @@ button {
#copy-share-url { #copy-share-url {
display: inline-block; display: inline-block;
margin: 0; margin: 0;
width: 70px; width: 75px;
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
border-radius: 2px;
vertical-align: middle; vertical-align: middle;
color: white; color: white;
border-radius: 5px;
.niceblue; .niceblue;
......
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
padding: 5px 0; padding: 5px 0;
background-color: #ffffff; background-color: #ffffff;
font-size: 12px; font-size: 12px;
box-shadow: 2px 5px 15px rgba(0, 0, 0, .5); box-shadow: 0 1px 5px hsla(0, 0%, 0%, 0.3);
border-radius: 3px; /* border-radius: 3px; */
min-width: 160px; min-width: 160px;
_width: 160px; _width: 160px;
-webkit-transform: translateX(2px); -webkit-transform: translateX(2px);
font-family: Arial, "Heiti SC", "Microsoft Yahei"; font-family: Arial, "Heiti SC", "Microsoft Yahei";
/* border-top: 3px solid hsl(224, 16%, 27%); */
} }
.kmui-combobox-menu .kmui-combobox-item { .kmui-combobox-menu .kmui-combobox-item {
...@@ -47,6 +48,7 @@ ...@@ -47,6 +48,7 @@
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0099f2', endColorstr='#0076dd',GradientType=0 ); /* IE6-8 */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0099f2', endColorstr='#0076dd',GradientType=0 ); /* IE6-8 */
color: white; color: white;
background: hsl(222, 14%, 41%);
/*border: 1px solid #a3bde3;*/ /*border: 1px solid #a3bde3;*/
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
right:10px; right:10px;
background-color: #fff; background-color: #fff;
outline: 0; outline: 0;
border-radius: 5px; /* border-radius: 5px; */
box-shadow: 3px 3px 8px rgba(0,0,0, .5); box-shadow: 3px 3px 8px rgba(0,0,0, .5);
} }
.kmui-modal input[type=text] { .kmui-modal input[type=text] {
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
font-size: 12px; font-size: 12px;
list-style: none; list-style: none;
background-color: #ffffff; background-color: #ffffff;
border-radius: 3px; border-radius: 0;
box-shadow: 2px 5px 15px rgba(0, 0, 0, .5); box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
background-clip: padding-box; background-clip: padding-box;
font-family: Arial, "Heiti SC", "Microsoft Yahei"; font-family: Arial, "Heiti SC", "Microsoft Yahei";
} }
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */ background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */ background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */ background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: #5a6378; /* W3C */ background: hsl(222, 14%, 41%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0099f2', endColorstr='#0076dd',GradientType=0 ); /* IE6-8 */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0099f2', endColorstr='#0076dd',GradientType=0 ); /* IE6-8 */
color: white; color: white;
......
...@@ -2,15 +2,23 @@ ...@@ -2,15 +2,23 @@
html, body, div { html, body, div {
margin: 0; margin: 0;
padding: 0; padding: 0;
/* background: #FFFFFF; */ margin-top: 0 !important;
} }
html, body, #kityminder, div.kmui-editor-body { html, body, #kityminder, div.kmui-editor-body {
overflow: hidden; overflow: hidden;
-moz-user-select: none; -moz-user-select: none;
width: 100%;
}
#content-wrapper {
overflow: hidden;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
} }
#title, #panel { #title, #panel {
background: #393F4F; background: hsl(224, 16%, 27%);
font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei'; font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei';
/* -webkit-font-smoothing: antialiased; */ /* -webkit-font-smoothing: antialiased; */
} }
...@@ -26,6 +34,10 @@ html, body, #kityminder, div.kmui-editor-body { ...@@ -26,6 +34,10 @@ html, body, #kityminder, div.kmui-editor-body {
text-align: center; text-align: center;
font-weight: 300; font-weight: 300;
font-size: 14px; font-size: 14px;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-word;
white-space: nowrap;
} }
#panel { #panel {
...@@ -57,7 +69,6 @@ html, body, #kityminder, div.kmui-editor-body { ...@@ -57,7 +69,6 @@ html, body, #kityminder, div.kmui-editor-body {
#menu { #menu {
float: left; float: left;
flo
} }
#panel button:hover, #panel button.active { #panel button:hover, #panel button.active {
...@@ -114,6 +125,7 @@ button#tool-btn { ...@@ -114,6 +125,7 @@ button#tool-btn {
#panel button#tool-btn { #panel button#tool-btn {
padding-right: 20px; padding-right: 20px;
position: relative; position: relative;
overflow: visible;
} }
#panel button#tool-btn.active:before { #panel button#tool-btn.active:before {
...@@ -253,7 +265,7 @@ svg, body { ...@@ -253,7 +265,7 @@ svg, body {
font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif; font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif;
} }
#about { #about {
position:absolute; position: absolute;
bottom: 0; bottom: 0;
right: 0; right: 0;
height: 40px; height: 40px;
...@@ -261,21 +273,27 @@ svg, body { ...@@ -261,21 +273,27 @@ svg, body {
background: #5d697a; background: #5d697a;
color: #eee; color: #eee;
font-family:Arial; font-family:Arial;
font-size:13px; font-size: 13px;
font-weight:normal; font-weight:normal;
margin:0; margin:0;
text-align: right; text-align: right;
padding: 0 15px 0 60px; padding: 0 15px 0 60px;
border-bottom: 5px solid #393F4F; border-bottom: 5px solid #393F4F;
-webkit-font-smoothing: antialiased;
position: absolute;
transition: all ease .3s 0.3s; transition: all ease .3s 0.3s;
-webkit-transform: translate(100%); -webkit-transform: translate(100%);
-moz-transform: translate(100%);
-ms-transform: translate(100%);
-o-transform: translate(100%);
transform: translate(100%);
} }
#about:hover { #about:hover, #about:hover #km-cat {
-webkit-transform: translate(0); -webkit-transform: translate(0);
-moz-transform: translate(0);
-ms-transform: translate(0);
-o-transform: translate(0);
transform: translate(0);
} }
#about a { #about a {
color: #eee; color: #eee;
...@@ -286,11 +304,12 @@ svg, body { ...@@ -286,11 +304,12 @@ svg, body {
top: 5px; top: 5px;
transition: all ease 1.3s 0.3s; transition: all ease 1.3s 0.3s;
-webkit-transform: translate(-60px, 0); -webkit-transform: translate(-60px, 0);
-moz-transform: translate(-60px, 0);
-ms-transform: translate(-60px, 0);
-o-transform: translate(-60px, 0);
transform: translate(-60px, 0);
cursor: pointer; cursor: pointer;
} }
#about:hover #km-cat {
-webkit-transform: translate(0);
}
#about #cat-face { #about #cat-face {
fill: #393F4F; fill: #393F4F;
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<meta name="title" content="百度脑图(KityMinder)"> <meta name="title" content="百度脑图(KityMinder)">
<meta name="keyword" content="kityminder,脑图,思维导图,kity,svg,minder,百度,fex,前端,在线"> <meta name="keyword" content="kityminder,脑图,思维导图,kity,svg,minder,百度,fex,前端,在线">
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。"> <meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<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>
...@@ -34,11 +35,12 @@ ...@@ -34,11 +35,12 @@
</head> </head>
<body> <body>
<div id="content-wrapper">
<div id="panel"></div> <div id="panel"></div>
<div id="kityminder" onselectstart="return false"></div> <div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" > <div id="share-dialog">
<h3>URL分享:</h3> <h3>URL分享:</h3>
<p> <p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" /> <input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
...@@ -94,6 +96,7 @@ ...@@ -94,6 +96,7 @@
target="_blank">Contact Us target="_blank">Contact Us
</a> </a>
</div> </div>
</div>
</body> </body>
<!--脑图启动代码--> <!--脑图启动代码-->
...@@ -124,6 +127,10 @@ ...@@ -124,6 +127,10 @@
km.on('unknownprotocal', function(ev) { km.on('unknownprotocal', function(ev) {
alert('不支持的文件格式!'); alert('不支持的文件格式!');
}); });
document.body.ontouchmove = function(e) {
//e.preventDefault();
}
</script> </script>
<!--社会分享代码--> <!--社会分享代码-->
......
Subproject commit 5a3fc4422c0d3f1c2d812dd810d8ae7693fa3c93 Subproject commit 47c11b5d7977c81df1c2f1d779933d38ac6edb0e
KityMinder.LANG['zh-cn'] = { KityMinder.LANG['zh-cn'] = {
'template': { 'template': {
'default': '思维导图', 'default': '思维导图',
'structure': '组织结构图' 'structure': '组织结构图',
'filetree': '文件夹'
}, },
'theme': { 'theme': {
'classic': '脑图经典', 'classic': '脑图经典',
...@@ -35,8 +36,8 @@ KityMinder.LANG['zh-cn'] = { ...@@ -35,8 +36,8 @@ KityMinder.LANG['zh-cn'] = {
'image': '插入图片', 'image': '插入图片',
'hyperlink': '插入链接', 'hyperlink': '插入链接',
'unhyperlink': '删除链接', 'unhyperlink': '删除链接',
'expandnode': '展开节点', 'expandnode': '展开到叶子',
'collapsenode': '收起节点', 'collapsenode': '收起到一级节点',
'template': '模板', 'template': '模板',
'theme': '皮肤' 'theme': '皮肤'
}, },
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="kity/dist/kitygraph.all.js" charset="utf-8"></script>
<script src="import.js" charset="utf-8"></script>
<script src="kityminder.config.js" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<script src="lib/zip.js" charset="utf-8"></script>
<script>
zip.inflateJSPath = 'lib/inflate.js';
</script>
<script src="lib/jquery.xml2json.js" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="social/social.js" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
<link href="favicon.ico" type="image/x-icon" rel="apple-touch-icon-precomposed">
<style>
.kmui-toolbar, #social button#save-btn, #draft-btn, .user-file-menu li:first-child {
display: none;
}
</style>
</head>
<body>
<div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" >
<h3>URL分享:</h3>
<p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
<button id="copy-share-url" data-clipboard-target="share-url" type="button">复制</button>
</p>
<h3>社交分享:</h3>
<p id="share-platform" class="bdsharebuttonbox">
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
</p>
</div>
<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>
<script>
// create km instance
window.km = KM.getKityMinder('kityminder');
//km.setDisabled();
km.execCommand('hand');
</script>
</html>
\ No newline at end of file
This diff is collapsed.
...@@ -249,6 +249,10 @@ $(function() { ...@@ -249,6 +249,10 @@ $(function() {
e.stopPropagation(); e.stopPropagation();
}); });
$('body').delegate('#global-zeroclipboard-html-bridge', 'mousedown', function(e) {
e.stopPropagation();
});
var copyTrickTimer = 0; var copyTrickTimer = 0;
$('body').on('mousedown', function(e) { $('body').on('mousedown', function(e) {
copyTrickTimer = setTimeout(function() { copyTrickTimer = setTimeout(function() {
......
...@@ -183,7 +183,7 @@ button { ...@@ -183,7 +183,7 @@ button {
} }
input { input {
width: 260px; width: 255px;
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
padding: 4px 4px 0; padding: 4px 4px 0;
...@@ -204,7 +204,7 @@ button { ...@@ -204,7 +204,7 @@ button {
#copy-share-url { #copy-share-url {
display: inline-block; display: inline-block;
margin: 0; margin: 0;
width: 70px; width: 75px;
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
vertical-align: middle; vertical-align: middle;
......
...@@ -62,9 +62,13 @@ KM.registerUI( 'contextmenu', function () { ...@@ -62,9 +62,13 @@ KM.registerUI( 'contextmenu', function () {
if(item.divider){ if(item.divider){
data.pop(); data.pop();
} }
var pos = e.getPosition('screen');
var offset = $(me.getPaper().container).offset();
pos.y -= offset.top;
pos.x -= offset.left;
$menu.kmui().setData({ $menu.kmui().setData({
data:data data:data
}).position(e.getPosition()).show(); }).position(pos).show();
} }
}); });
......
...@@ -45,7 +45,7 @@ var keymap = KityMinder.keymap = (function(origin) { ...@@ -45,7 +45,7 @@ var keymap = KityMinder.keymap = (function(origin) {
'NumLock': 144, 'NumLock': 144,
'Cmd': 91, 'Cmd': 91,
'CmdFF':224,
'F2': 113, 'F2': 113,
'F3': 114, 'F3': 114,
'F4': 115, 'F4': 115,
...@@ -69,25 +69,42 @@ var keymap = KityMinder.keymap = (function(origin) { ...@@ -69,25 +69,42 @@ var keymap = KityMinder.keymap = (function(origin) {
'n': 78, 'n': 78,
'/': 191, '/': 191,
'.': 190, '.': 190,
'notContentInput': { controlKeys:{
8: 1, 16:1,
46: 1, 17:1,
18:1,
20:1,
91:1,
224:1
},
'notContentChange': {
13: 1, 13: 1,
9: 1, 9: 1,
33: 1, 33: 1,
34: 1, 34: 1,
35: 1, 35: 1,
36: 1, 36: 1,
16: 1, 16: 1,
17: 1, 17: 1,
18: 1, 18: 1,
20: 1,
91: 1,
//上下左右 //上下左右
37: 1, 37: 1,
38: 1, 38: 1,
39: 1, 39: 1,
40: 1, 40: 1,
113: 1
113: 1,
114: 1,
115: 1,
144: 1,
27: 1
}, },
'isSelectedNodeKey': { 'isSelectedNodeKey': {
//上下左右 //上下左右
37: 1, 37: 1,
...@@ -96,5 +113,7 @@ var keymap = KityMinder.keymap = (function(origin) { ...@@ -96,5 +113,7 @@ var keymap = KityMinder.keymap = (function(origin) {
40: 1, 40: 1,
13: 1, 13: 1,
9: 1 9: 1
} },
'a':65
}); });
\ No newline at end of file
...@@ -112,6 +112,30 @@ kity.extendClass(MinderNode, { ...@@ -112,6 +112,30 @@ kity.extendClass(MinderNode, {
return this; return this;
}, },
setVertexIn: function(p) {
this._vertexIn = p;
},
setVertexOut: function(p) {
this._vertexOut = p;
},
getVertexIn: function() {
return this._vertexIn || new kity.Point();
},
getVertexOut: function() {
return this._vertexOut || new kity.Point();
},
getLayoutVertexIn: function() {
return this.getGlobalLayoutTransform().transformPoint(this.getVertexIn());
},
getLayoutVertexOut: function() {
return this.getGlobalLayoutTransform().transformPoint(this.getVertexOut());
},
getLayoutRoot: function() { getLayoutRoot: function() {
if (this.isLayoutRoot()) { if (this.isLayoutRoot()) {
return this; return this;
...@@ -292,21 +316,27 @@ var Layout = kity.createClass('Layout', { ...@@ -292,21 +316,27 @@ var Layout = kity.createClass('Layout', {
}, },
/** /**
* 工具方法:计算给节点的子树所占的布局区域 * 工具方法:计算给定的节点的子树所占的布局区域
* *
* @param {MinderNode} nodes 需要计算的节点 * @param {MinderNode} nodes 需要计算的节点
* *
* @return {Box} 计算的结果 * @return {Box} 计算的结果
*/ */
getTreeBox: function(nodes) { getTreeBox: function(nodes) {
var i, node, matrix, treeBox;
var g = KityMinder.Geometry;
var box = { var box = {
x: 0, x: 0,
y: 0, y: 0,
height: 0, height: 0,
width: 0 width: 0
}; };
var g = KityMinder.Geometry;
var i, node, matrix, treeBox; if (!(nodes instanceof Array)) nodes = [nodes];
for (i = 0; i < nodes.length; i++) { for (i = 0; i < nodes.length; i++) {
node = nodes[i]; node = nodes[i];
matrix = node.getLayoutTransform(); matrix = node.getLayoutTransform();
...@@ -319,6 +349,7 @@ var Layout = kity.createClass('Layout', { ...@@ -319,6 +349,7 @@ var Layout = kity.createClass('Layout', {
box = g.mergeBox(box, matrix.transformBox(treeBox)); box = g.mergeBox(box, matrix.transformBox(treeBox));
} }
return box; return box;
}, },
......
/* global Layout:true */ /* global Layout:true */
window.layoutSwitch = true; window.layoutSwitch = true;
KityMinder.registerLayout('bottom', kity.createClass({ KityMinder.registerLayout('bottom', kity.createClass({
base: Layout, base: Layout,
doLayout: function(node) { doLayout: function(node) {
var layout = this;
if (node.isLayoutRoot()) {
this.doLayoutRoot(node);
} else {
this.arrange(node);
}
},
doLayoutRoot: function(root) {
this.arrange(root);
},
arrange: function(node) {
var children = node.getChildren(); var children = node.getChildren();
var _this = this;
if (!children.length) { if (!children.length) {
return false; return false;
} else { }
var totalTreeWidth = 0;
// 计算每个 child 的树所占的矩形区域 var me = this;
var childTreeBoxes = children.map(function(node, index, children) {
var box = _this.getTreeBox([node]); // 子树的总宽度(包含间距)
totalTreeWidth += box.width; var totalTreeWidth = 0;
if (index > 0) {
totalTreeWidth += children[index - 1].getStyle('margin-left'); // 父亲所占的区域
totalTreeWidth += node.getStyle('margin-right'); var nodeContentBox = node.getContentBox();
}
return box; // 为每一颗子树准备的迭代变量
}); var i, x0, x, y, child, childTreeBox, childContentBox, matrix;
var nodeContentBox = node.getContentBox();
node.setLayoutVector(new kity.Vector(nodeContentBox.cx, nodeContentBox.bottom)); // 先最左对齐
var i, x, y, child, childTreeBox, childContentBox; x0 = x = nodeContentBox.left;
var transform = new kity.Matrix();
for (i = 0; i < children.length; i++) {
x = -totalTreeWidth / 2;
child = children[i];
for (i = 0; i < children.length; i++) { childContentBox = child.getContentBox();
child = children[i]; childTreeBox = this.getTreeBox(child);
childTreeBox = childTreeBoxes[i]; matrix = new kity.Matrix();
childContentBox = child.getContentBox();
if (!childContentBox.width) continue;
//水平方向上的布局
x += childTreeBox.width / 2;
if (i > 0) {
x += children[i].getStyle('margin-left');
}
y = nodeContentBox.height + node.getStyle('margin-bottom') + children[i].getStyle('margin-top');
children[i].setLayoutTransform(new kity.Matrix().translate(x, y));
x += childTreeBox.width / 2 + children[i].getStyle('margin-right');
}
if (node.isRoot()) { // 忽略无宽度的节点(收起的)
var branchBox = this.getBranchBox(children); if (!childContentBox.width) continue;
var dx = branchBox.cx - nodeContentBox.cx;
children.forEach(function(child) { if (i > 0) {
child.getLayoutTransform().translate(-dx, 0); x += child.getStyle('margin-left');
});
} }
x -= childTreeBox.left;
// arrange x
matrix.translate(x, 0);
// 为下个位置准备
x += childTreeBox.right;
if (i < children.length - 1) x += child.getStyle('margin-right');
y = nodeContentBox.bottom - childTreeBox.top +
node.getStyle('margin-bottom') + child.getStyle('margin-top');
matrix.translate(0, y);
// 设置结果
child.setLayoutTransform(matrix);
child.setVertexIn(new kity.Point(childContentBox.cx, childContentBox.top));
} }
// 设置布局矢量为向下
node.setLayoutVector(new kity.Vector(0, 1));
// 设置流出顶点
node.setVertexOut(new kity.Point(nodeContentBox.cx, nodeContentBox.bottom));
var dx = (x - x0 - nodeContentBox.width) / 2;
children.forEach(function(child) {
child.getLayoutTransform().translate(-dx, 0);
});
}, },
getOrderHint: function(node) { getOrderHint: function(node) {
...@@ -98,13 +107,14 @@ KityMinder.registerLayout('bottom', kity.createClass({ ...@@ -98,13 +107,14 @@ KityMinder.registerLayout('bottom', kity.createClass({
})); }));
KityMinder.registerConnectProvider('bottom', function(node, parent, connection) { KityMinder.registerConnectProvider('bottom', function(node, parent, connection) {
var box = node.getLayoutBox(), var pout = parent.getLayoutVertexOut(),
pBox = parent.getLayoutBox(); pin = node.getLayoutVertexIn();
var pathData = []; var pathData = [];
pathData.push('M', new kity.Point(pBox.cx, pBox.bottom)); var r = Math.round;
pathData.push('L', new kity.Point(pBox.cx, pBox.bottom + parent.getStyle('margin-bottom'))); pathData.push('M', new kity.Point(r(pout.x), pout.y));
pathData.push('L', new kity.Point(box.cx, pBox.bottom + parent.getStyle('margin-bottom'))); pathData.push('L', new kity.Point(r(pout.x), pout.y + parent.getStyle('margin-bottom')));
pathData.push('L', new kity.Point(box.cx, box.top)); pathData.push('L', new kity.Point(r(pin.x), pout.y + parent.getStyle('margin-bottom')));
pathData.push('L', new kity.Point(r(pin.x), pin.y));
connection.setMarker(null); connection.setMarker(null);
connection.setPathData(pathData); connection.setPathData(pathData);
}); });
\ No newline at end of file
...@@ -67,9 +67,11 @@ KityMinder.registerLayout('default', kity.createClass({ ...@@ -67,9 +67,11 @@ KityMinder.registerLayout('default', kity.createClass({
y = -totalTreeHeight / 2; y = -totalTreeHeight / 2;
if (side != 'left') { if (side != 'left') {
parent.setLayoutVector(new kity.Vector(nodeContentBox.right, nodeContentBox.cy)); parent.setVertexOut(new kity.Point(nodeContentBox.right, nodeContentBox.cy));
parent.setLayoutVector(new kity.Vector(1, 0));
} else { } else {
parent.setLayoutVector(new kity.Vector(nodeContentBox.left, nodeContentBox.cy)); parent.setVertexOut(new kity.Point(nodeContentBox.left, nodeContentBox.cy));
parent.setLayoutVector(new kity.Vector(-1, 0));
} }
for (i = 0; i < children.length; i++) { for (i = 0; i < children.length; i++) {
......
...@@ -27,10 +27,12 @@ KityMinder.registerLayout('filetree', kity.createClass({ ...@@ -27,10 +27,12 @@ KityMinder.registerLayout('filetree', kity.createClass({
return box; return box;
}); });
var nodeContentBox = node.getContentBox(); var nodeContentBox = node.getContentBox();
node.setLayoutVector(new kity.Vector(0, nodeContentBox.bottom));
var i, x, y, child, childTreeBox, childContentBox; var i, x, y, child, childTreeBox, childContentBox;
var transform = new kity.Matrix(); var transform = new kity.Matrix();
node.setVertexOut(new kity.Point(0, nodeContentBox.bottom));
node.setLayoutVector(new kity.Vector(0, 1));
y = nodeContentBox.bottom + node.getStyle('margin-bottom'); y = nodeContentBox.bottom + node.getStyle('margin-bottom');
for (i = 0; i < children.length; i++) { for (i = 0; i < children.length; i++) {
......
...@@ -38,6 +38,7 @@ var DropHinter = kity.createClass('DropHinter', { ...@@ -38,6 +38,7 @@ var DropHinter = kity.createClass('DropHinter', {
target.getStyle('drop-hint-color') || 'yellow', target.getStyle('drop-hint-color') || 'yellow',
target.getStyle('drop-hint-width') || 2 target.getStyle('drop-hint-width') || 2
); );
this.bringTop();
} }
} }
}); });
...@@ -299,7 +300,12 @@ var TreeDragger = kity.createClass('TreeDragger', { ...@@ -299,7 +300,12 @@ var TreeDragger = kity.createClass('TreeDragger', {
function area(box) { function area(box) {
return box.width * box.height; return box.width * box.height;
} }
return intersectBox && area(intersectBox) > 0.5 * Math.min(area(sourceBox), area(targetBox)); if (!intersectBox) return false;
// 面积判断
if (area(intersectBox) > 0.5 * Math.min(area(sourceBox), area(targetBox))) return true;
if (intersectBox.width + 1 >= Math.min(sourceBox.width, targetBox.width)) return true;
if (intersectBox.height + 1 >= Math.min(sourceBox.height, targetBox.height)) return true;
return false;
}); });
this._renderDropHint(this._dropSucceedTarget); this._renderDropHint(this._dropSucceedTarget);
return !!this._dropSucceedTarget; return !!this._dropSucceedTarget;
...@@ -320,7 +326,7 @@ var TreeDragger = kity.createClass('TreeDragger', { ...@@ -320,7 +326,7 @@ var TreeDragger = kity.createClass('TreeDragger', {
_renderOrderHint: function(hint) { _renderOrderHint: function(hint) {
this._orderHinter.render(hint); this._orderHinter.render(hint);
}, },
preventDragMove:function(){ preventDragMove: function() {
this._startPosition = null; this._startPosition = null;
} }
}); });
...@@ -348,8 +354,8 @@ KityMinder.registerModule('DragTree', function() { ...@@ -348,8 +354,8 @@ KityMinder.registerModule('DragTree', function() {
e.stopPropagation(); e.stopPropagation();
this.fire('contentchange'); this.fire('contentchange');
}, },
'statuschange':function(e){ 'statuschange': function(e) {
if(e.lastStatus == 'textedit' && e.currentStatus == 'normal'){ if (e.lastStatus == 'textedit' && e.currentStatus == 'normal') {
dragger.preventDragMove(); dragger.preventDragMove();
} }
} }
......
...@@ -31,11 +31,22 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -31,11 +31,22 @@ KityMinder.registerModule('TextEditModule', function() {
.setColor(color); .setColor(color);
receiver receiver
.setMinderNode(node) .setMinderNode(node)
.updateContainerRangeBySel(); .updateContainerRangeBySel();
if(browser.ie ){
var timer = setInterval(function(){
var nativeRange = range.nativeSel.getRangeAt(0);
if(!nativeRange || nativeRange.collapsed){
range.select();
}else {
clearInterval(timer);
}
});
}
receiver.minderNode.setTmpData('_lastTextContent',receiver.textShape.getContent()); receiver.minderNode.setTmpData('_lastTextContent',receiver.textShape.getContent());
km.setStatus('inputready'); km.setStatus('inputready');
...@@ -108,7 +119,7 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -108,7 +119,7 @@ KityMinder.registerModule('TextEditModule', function() {
if(selectionReadyShow){ if(selectionReadyShow){
textShape.setStyle('cursor', 'text'); textShape.setStyle('cursor', 'text');
sel.clearBaseOffset();
receiver.updateSelection(); receiver.updateSelection();
setTimeout(function() { setTimeout(function() {
sel.setShow(); sel.setShow();
...@@ -123,7 +134,8 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -123,7 +134,8 @@ KityMinder.registerModule('TextEditModule', function() {
} }
//模拟光标没有准备好 //模拟光标没有准备好
receiver.clearReady(); receiver.clearReady();
//当点击空白处时,光标需要消失
receiver.clear();
}, },
'inputready.keyup':function(e){ 'inputready.keyup':function(e){
...@@ -162,7 +174,7 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -162,7 +174,7 @@ KityMinder.registerModule('TextEditModule', function() {
sel.setColor(node.getStyle('text-selection-color')); sel.setColor(node.getStyle('text-selection-color'));
sel.clearBaseOffset();
node.getTextShape().setStyle('cursor', 'text'); node.getTextShape().setStyle('cursor', 'text');
...@@ -191,7 +203,7 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -191,7 +203,7 @@ KityMinder.registerModule('TextEditModule', function() {
}else { }else {
//当有光标时,要同步选区 //当有光标时,要同步选区
if(!sel.collapsed){ if(!sel.collapsed){
sel.clearBaseOffset();
receiver.updateContainerRangeBySel(); receiver.updateContainerRangeBySel();
} }
...@@ -215,7 +227,8 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -215,7 +227,8 @@ KityMinder.registerModule('TextEditModule', function() {
var offset = e.getPosition(this.getRenderContainer()); var offset = e.getPosition(this.getRenderContainer());
dir = offset.x > lastEvtPosition.x ? 1 : (offset.x < lastEvtPosition.x ? -1 : dir); dir = offset.x > lastEvtPosition.x ? 1 : (offset.x < lastEvtPosition.x ? -1 : dir);
receiver.updateSelectionByMousePosition(offset, dir) receiver.updateSelectionByMousePosition(offset, dir)
.updateSelectionShow(dir); .updateSelectionShow(dir)
.updateContainerRangeBySel();
lastEvtPosition = e.getPosition(this.getRenderContainer()); lastEvtPosition = e.getPosition(this.getRenderContainer());
...@@ -261,9 +274,8 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -261,9 +274,8 @@ KityMinder.registerModule('TextEditModule', function() {
} }
receiver.clear(); if(sel.isShow()){
if (this.getStatus() == 'textedit') { receiver.updateTextOffsetData().updateSelection();
this.setStatus('normal');
} }
}, },
'layoutfinish':function(e){ 'layoutfinish':function(e){
...@@ -271,12 +283,18 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -271,12 +283,18 @@ KityMinder.registerModule('TextEditModule', function() {
receiver receiver
.setBaseOffset() .setBaseOffset()
.setContainerStyle(); .setContainerStyle();
} }
}, },
'selectionclear': function() { 'selectionclear': function() {
km.setStatus('normal'); var node = km.getSelectedNode();
receiver.clear(); if(node){
inputStatusReady(node);
}else{
km.setStatus('normal');
receiver.clear();
}
}, },
'blur': function() { 'blur': function() {
receiver.clear(); receiver.clear();
...@@ -288,6 +306,7 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -288,6 +306,7 @@ KityMinder.registerModule('TextEditModule', function() {
'textedit.mousewheel': function() { 'textedit.mousewheel': function() {
receiver.setContainerStyle(); receiver.setContainerStyle();
} }
} }
}; };
}); });
\ No newline at end of file
...@@ -43,11 +43,19 @@ Minder.Range = kity.createClass('Range',{ ...@@ -43,11 +43,19 @@ Minder.Range = kity.createClass('Range',{
startOffset:range.startOffset startOffset:range.startOffset
}; };
}, },
getStartOffset:function(){
return this.nativeRange.startOffset;
},
getEndOffset:function(){
return this.nativeRange.endOffset;
},
collapse:function(toStart){ collapse:function(toStart){
this.nativeRange.collapse(toStart === true); this.nativeRange.collapse(toStart === true);
return this; return this;
}, },
isCollapsed:function(){
return this.nativeRange.collapsed;
},
insertNode:function(node){ insertNode:function(node){
this.nativeRange.insertNode(node); this.nativeRange.insertNode(node);
return this; return this;
...@@ -57,4 +65,5 @@ Minder.Range = kity.createClass('Range',{ ...@@ -57,4 +65,5 @@ Minder.Range = kity.createClass('Range',{
this.nativeRange = this.nativeSel.getRangeAt(0); this.nativeRange = this.nativeSel.getRangeAt(0);
return this; return this;
} }
}); });
\ No newline at end of file
This diff is collapsed.
...@@ -109,8 +109,5 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -109,8 +109,5 @@ Minder.Selection = kity.createClass( 'Selection', {
}, },
isHide:function(){ isHide:function(){
return !this._show; return !this._show;
},
clearBaseOffset:function(){
this.baseOffset = this.currentEndOffset = null;
} }
} ); } );
\ No newline at end of file
...@@ -117,8 +117,7 @@ KityMinder.registerModule('Expand', function() { ...@@ -117,8 +117,7 @@ KityMinder.registerModule('Expand', function() {
var ExpandNodeCommand = kity.createClass('ExpandNodeCommand', { var ExpandNodeCommand = kity.createClass('ExpandNodeCommand', {
base: Command, base: Command,
execute: function(km) { execute: function(km) {
var nodes = km.getSelectedNodes(); var nodes = km.getRoot().getChildren();
if (!nodes.length) nodes.push(km.getRoot());
nodes.forEach(function(node) { nodes.forEach(function(node) {
node.expand(EXPAND_POLICY.DEEP_TO_LEAF); node.expand(EXPAND_POLICY.DEEP_TO_LEAF);
}); });
...@@ -163,6 +162,10 @@ KityMinder.registerModule('Expand', function() { ...@@ -163,6 +162,10 @@ KityMinder.registerModule('Expand', function() {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
}); });
this.on('dblclick click mouseup', function(e) {
e.stopPropagation();
e.preventDefault();
});
}, },
setState: function(state) { setState: function(state) {
...@@ -202,22 +205,13 @@ KityMinder.registerModule('Expand', function() { ...@@ -202,22 +205,13 @@ KityMinder.registerModule('Expand', function() {
expander.setState(visible && node.children.length ? node.getData(EXPAND_STATE_DATA) : 'hide'); expander.setState(visible && node.children.length ? node.getData(EXPAND_STATE_DATA) : 'hide');
var x, y; var vector = node.getLayoutVector().normalize(expander.radius + node.getStyle('stroke-width'));
var position = node.getVertexOut().offset(vector);
var pos = node.getLayoutVector();
pos = new kity.Vector(pos.x, pos.y);
pos = pos.normalize(pos.length() + expander.radius + 1); this.expander.setTranslate(position);
this.expander.setTranslate(pos);
} }
}); });
return { return {
addShortcutKeys: {
'ExpandNode': 'ctrl+/', //expand
'CollapseNode': 'ctrl+.' //collapse
},
commands: { commands: {
'ExpandNode': ExpandNodeCommand, 'ExpandNode': ExpandNodeCommand,
'CollapseNode': CollapseNodeCommand 'CollapseNode': CollapseNodeCommand
...@@ -229,14 +223,23 @@ KityMinder.registerModule('Expand', function() { ...@@ -229,14 +223,23 @@ KityMinder.registerModule('Expand', function() {
r.update(r.getRenderShape(), e.node); r.update(r.getRenderShape(), e.node);
} }
}, },
'preimport': function(e) {
var json = e.json;
},
'beforerender': function(e) { 'beforerender': function(e) {
var node = e.node; var node = e.node;
var visible = !node.parent || node.parent.isExpanded(); var visible = !node.parent || node.parent.isExpanded();
node.getRenderContainer().setVisible(visible); node.getRenderContainer().setVisible(visible);
if (!visible) e.stopPropagation(); if (!visible) e.stopPropagation();
},
'normal.keydown': function(e) {
if (this.getStatus() == 'textedit') return;
if (e.originEvent.keyCode == keymap['/']) {
var expanded = this.getSelectedNode().isExpanded();
this.getSelectedNodes().forEach(function(node) {
if (expanded) node.collapse();
else node.expand();
});
e.preventDefault();
e.stopPropagationImmediately();
}
} }
}, },
renderers: { renderers: {
......
...@@ -102,8 +102,9 @@ KityMinder.registerModule("HistoryModule", function() { ...@@ -102,8 +102,9 @@ KityMinder.registerModule("HistoryModule", function() {
if (compareNode(srcNode, tagNode) === false) { if (compareNode(srcNode, tagNode) === false) {
srcNode.setValue(tagNode); srcNode.setValue(tagNode);
srcNode.render();
} }
//todo,这里有性能问题,变成全部render了
srcNode.render();
if (srcNode.isSelected()) { if (srcNode.isSelected()) {
selectedNodes.push(srcNode); selectedNodes.push(srcNode);
} }
......
...@@ -24,8 +24,8 @@ KityMinder.registerModule('image', function() { ...@@ -24,8 +24,8 @@ KityMinder.registerModule('image', function() {
} }
return { return {
width: width, width: width | 0,
height: height height: height | 0
}; };
} }
...@@ -46,6 +46,7 @@ KityMinder.registerModule('image', function() { ...@@ -46,6 +46,7 @@ KityMinder.registerModule('image', function() {
n.setData('imageSize', size); n.setData('imageSize', size);
n.render(); n.render();
}); });
km.fire("saveScene");
km.layout(300); km.layout(300);
}); });
...@@ -118,14 +119,17 @@ KityMinder.registerModule('image', function() { ...@@ -118,14 +119,17 @@ KityMinder.registerModule('image', function() {
if (!size) return; if (!size) return;
var x = box.cx - size.width / 2;
var y = box.y - size.height - spaceTop;
image image
.setUrl(url) .setUrl(url)
.setX(box.cx - size.width / 2) .setX(x | 0)
.setY(box.y - size.height - spaceTop) .setY(y | 0)
.setWidth(size.width) .setWidth(size.width | 0)
.setHeight(size.height); .setHeight(size.height | 0);
return new kity.Box(image.getX(), image.getY(), size.width, size.height); return new kity.Box(x | 0, y | 0, size.width | 0, size.height | 0);
} }
}); });
......
...@@ -183,8 +183,8 @@ KityMinder.registerModule("KeyboardModule", function() { ...@@ -183,8 +183,8 @@ KityMinder.registerModule("KeyboardModule", function() {
} }
}, },
'normal.keyup':function(e){ 'normal.keyup': function(e) {
if(browser.ipad){ if (browser.ipad) {
var keys = KityMinder.keymap; var keys = KityMinder.keymap;
var node = e.getTargetNode(); var node = e.getTargetNode();
var lang = this.getLang(); var lang = this.getLang();
......
...@@ -202,9 +202,9 @@ KityMinder.registerModule('Resource', function() { ...@@ -202,9 +202,9 @@ KityMinder.registerModule('Resource', function() {
rect = this.rect; rect = this.rect;
rect.setPosition(0, box.y - paddingY); rect.setPosition(0, box.y - paddingY);
rect.setSize( this.width = Math.round(box.width + paddingX * 2);
this.width = box.width + paddingX * 2, this.height = Math.round(box.height + paddingY * 2);
this.height = box.height + paddingY * 2); rect.setSize(this.width, this.height);
rect.fill(color); rect.fill(color);
} }
}); });
...@@ -244,7 +244,7 @@ KityMinder.registerModule('Resource', function() { ...@@ -244,7 +244,7 @@ KityMinder.registerModule('Resource', function() {
} }
overlay.setVisible(true); overlay.setVisible(true);
overlay.setValue(resource[i], minder.getResourceColor(resource[i])); overlay.setValue(resource[i], minder.getResourceColor(resource[i]));
overlay.setTranslate(x, 0); overlay.setTranslate(x, -1);
x += overlay.width; x += overlay.width;
} }
...@@ -255,7 +255,7 @@ KityMinder.registerModule('Resource', function() { ...@@ -255,7 +255,7 @@ KityMinder.registerModule('Resource', function() {
return { return {
x: box.right, x: box.right,
y: -overlays[0].height / 2, y: Math.round(-overlays[0].height / 2),
width: x, width: x,
height: overlays[0].height height: overlays[0].height
}; };
......
...@@ -81,6 +81,9 @@ KityMinder.registerModule('Select', function() { ...@@ -81,6 +81,9 @@ KityMinder.registerModule('Select', function() {
// 应用选中范围 // 应用选中范围
minder.select(selectedNodes, true); minder.select(selectedNodes, true);
// 清除多余的东西
window.getSelection().removeAllRanges()
}, },
selectEnd: function(e) { selectEnd: function(e) {
if (startPosition) { if (startPosition) {
...@@ -98,6 +101,11 @@ KityMinder.registerModule('Select', function() { ...@@ -98,6 +101,11 @@ KityMinder.registerModule('Select', function() {
var lastDownNode = null, lastDownPosition = null; var lastDownNode = null, lastDownPosition = null;
return { return {
'init': function() {
window.addEventListener('mouseup', function() {
marqueeActivator.selectEnd();
});
},
'events': { 'events': {
'normal.mousedown textedit.mousedown inputready.mousedown': function(e) { 'normal.mousedown textedit.mousedown inputready.mousedown': function(e) {
...@@ -146,6 +154,22 @@ KityMinder.registerModule('Select', function() { ...@@ -146,6 +154,22 @@ KityMinder.registerModule('Select', function() {
// 清理一下选择状态 // 清理一下选择状态
marqueeActivator.selectEnd(e); marqueeActivator.selectEnd(e);
},
//全选操作
'normal.keydown inputready.keydown':function(e){
var keyEvent = e.originEvent;
if ( (keyEvent.ctrlKey || keyEvent.metaKey) && keymap.a == keyEvent.keyCode){
var selectedNodes = [];
this.getRoot().traverse(function(node){
selectedNodes.push(node);
});
this.select(selectedNodes,true);
e.preventDefault();
}
} }
} }
}; };
......
...@@ -28,8 +28,11 @@ var ViewDragger = kity.createClass("ViewDragger", { ...@@ -28,8 +28,11 @@ var ViewDragger = kity.createClass("ViewDragger", {
lastPosition = null, lastPosition = null,
currentPosition = null; currentPosition = null;
this._minder.on('normal.mousedown readonly.mousedown readonly.touchstart', function (e) { this._minder.on('normal.mousedown normal.touchstart readonly.mousedown readonly.touchstart', function(e) {
e.originEvent.preventDefault(); // 阻止中键拉动
if (e.originEvent.button == 2) {
e.originEvent.preventDefault(); // 阻止中键拉动
}
// 点击未选中的根节点临时开启 // 点击未选中的根节点临时开启
if (e.getTargetNode() == this.getRoot() || e.originEvent.button == 2) { if (e.getTargetNode() == this.getRoot() || e.originEvent.button == 2) {
lastPosition = e.getPosition(); lastPosition = e.getPosition();
...@@ -37,13 +40,13 @@ var ViewDragger = kity.createClass("ViewDragger", { ...@@ -37,13 +40,13 @@ var ViewDragger = kity.createClass("ViewDragger", {
} }
}) })
.on('normal.mousemove normal.touchmove', function(e) { .on('normal.mousemove normal.touchmove readonly.touchmove readonly.mousemove', function(e) {
if (!isTempDrag) return; if (!isTempDrag) return;
var offset = kity.Vector.fromPoints(lastPosition, e.getPosition()); var offset = kity.Vector.fromPoints(lastPosition, e.getPosition());
if (offset.length() > 3) this.setStatus('hand'); if (offset.length() > 3) this.setStatus('hand');
}) })
.on('hand.beforemousedown hand.beforetouchend', function(e) { .on('hand.beforemousedown hand.beforetouchstart', function(e) {
// 已经被用户打开拖放模式 // 已经被用户打开拖放模式
if (dragger.isEnabled()) { if (dragger.isEnabled()) {
lastPosition = e.getPosition(); lastPosition = e.getPosition();
...@@ -65,7 +68,7 @@ var ViewDragger = kity.createClass("ViewDragger", { ...@@ -65,7 +68,7 @@ var ViewDragger = kity.createClass("ViewDragger", {
} }
}) })
.on('mouseup', function(e) { .on('mouseup touchend', function(e) {
lastPosition = null; lastPosition = null;
// 临时拖动需要还原状态 // 临时拖动需要还原状态
...@@ -86,8 +89,7 @@ KityMinder.registerModule('View', function() { ...@@ -86,8 +89,7 @@ KityMinder.registerModule('View', function() {
base: Command, base: Command,
execute: function(minder) { execute: function(minder) {
minder._viewDragger.setEnabled(!minder._viewDragger.isEnabled()); if (minder.getStatus() != 'hand') {
if (minder._viewDragger.isEnabled()) {
minder.setStatus('hand'); minder.setStatus('hand');
} else { } else {
minder.rollbackStatus(); minder.rollbackStatus();
...@@ -96,7 +98,7 @@ KityMinder.registerModule('View', function() { ...@@ -96,7 +98,7 @@ KityMinder.registerModule('View', function() {
}, },
queryState: function(minder) { queryState: function(minder) {
return minder._viewDragger.isEnabled() ? 1 : 0; return minder.getStatus() == 'hand' ? 1 : 0;
}, },
enableReadOnly: false enableReadOnly: false
}); });
...@@ -156,7 +158,10 @@ KityMinder.registerModule('View', function() { ...@@ -156,7 +158,10 @@ KityMinder.registerModule('View', function() {
e.preventDefault(); e.preventDefault();
} }
}, },
mousewheel: function (e) { statuschange: function(e) {
this._viewDragger.setEnabled(e.currentStatus == 'hand');
},
mousewheel: function(e) {
var dx, dy; var dx, dy;
e = e.originEvent; e = e.originEvent;
if (e.ctrlKey || e.shiftKey) return; if (e.ctrlKey || e.shiftKey) return;
......
...@@ -3,49 +3,54 @@ KityMinder.registerModule('Zoom', function() { ...@@ -3,49 +3,54 @@ KityMinder.registerModule('Zoom', function() {
var timeline; var timeline;
me.setDefaultOptions('zoom', [50, 80, 100, 120, 150, 200]); me.setDefaultOptions('zoom', [10, 20, 30, 50, 80, 100, 120, 150, 200]);
function fixPaperCTM() { function fixPaperCTM(paper) {
var paper = me.getPaper();
var node = paper.shapeNode; var node = paper.shapeNode;
var ctm = node.getCTM(); var ctm = node.getCTM();
var matrix = new kity.Matrix(ctm.a, ctm.b, ctm.c, ctm.d, (ctm.e | 0) + 0.5, (ctm.f | 0) + 0.5); var matrix = new kity.Matrix(ctm.a, ctm.b, ctm.c, ctm.d, (ctm.e | 0) + 0.5, (ctm.f | 0) + 0.5);
node.setAttribute('transform', 'matrix(' + matrix.toString() + ')'); node.setAttribute('transform', 'matrix(' + matrix.toString() + ')');
} }
function zoomMinder(minder, zoom) { kity.extendClass(Minder, {
zoom: function(value) {
var paper = this.getPaper();
var viewport = paper.getViewPort();
viewport.zoom = value / 100;
viewport.center = {
x: viewport.center.x,
y: viewport.center.y
};
paper.setViewPort(viewport);
if (value == 100) fixPaperCTM(paper);
}
});
function zoomMinder(minder, value) {
var paper = minder.getPaper(); var paper = minder.getPaper();
var viewport = paper.getViewPort(); var viewport = paper.getViewPort();
if (!zoom) return; if (!value) return;
var animator = new kity.Animator({ var animator = new kity.Animator({
beginValue: viewport.zoom, beginValue: minder._zoomValue,
finishValue: zoom / 100, finishValue: value,
setter: function(target, value) { setter: function(target, value) {
viewport.zoom = value; target.zoom(value);
viewport.center = {
x: viewport.center.x,
y: viewport.center.y
};
target.setViewPort(viewport);
fixPaperCTM();
} }
}); });
minder.zoom = zoom; minder._zoomValue = value;
if (timeline) { if (timeline) {
timeline.pause(); timeline.pause();
} }
timeline = animator.start(paper, 500, 'ease', function() { timeline = animator.start(minder, 300, 'easeInOutSine');
minder.refresh(500);
});
} }
var ZoomCommand = kity.createClass('Zoom', { var ZoomCommand = kity.createClass('Zoom', {
base: Command, base: Command,
execute: zoomMinder, execute: zoomMinder,
queryValue: function(minder) { queryValue: function(minder) {
return minder.zoom; return minder._zoomValue;
} }
}); });
...@@ -61,7 +66,7 @@ KityMinder.registerModule('Zoom', function() { ...@@ -61,7 +66,7 @@ KityMinder.registerModule('Zoom', function() {
var stack = minder.getOptions('zoom'), var stack = minder.getOptions('zoom'),
i; i;
for (i = 0; i < stack.length; i++) { for (i = 0; i < stack.length; i++) {
if (stack[i] > minder.zoom) return stack[i]; if (stack[i] > minder._zoomValue) return stack[i];
} }
return 0; return 0;
}, },
...@@ -80,7 +85,7 @@ KityMinder.registerModule('Zoom', function() { ...@@ -80,7 +85,7 @@ KityMinder.registerModule('Zoom', function() {
var stack = minder.getOptions('zoom'), var stack = minder.getOptions('zoom'),
i; i;
for (i = stack.length - 1; i >= 0; i--) { for (i = stack.length - 1; i >= 0; i--) {
if (stack[i] < minder.zoom) return stack[i]; if (stack[i] < minder._zoomValue) return stack[i];
} }
return 0; return 0;
}, },
...@@ -89,7 +94,7 @@ KityMinder.registerModule('Zoom', function() { ...@@ -89,7 +94,7 @@ KityMinder.registerModule('Zoom', function() {
return { return {
init: function() { init: function() {
this.zoom = 100; this._zoomValue = 100;
}, },
commands: { commands: {
'zoom-in': ZoomInCommand, 'zoom-in': ZoomInCommand,
...@@ -113,9 +118,6 @@ KityMinder.registerModule('Zoom', function() { ...@@ -113,9 +118,6 @@ KityMinder.registerModule('Zoom', function() {
} }
}, },
'ready': function() {
this._zoomValue = 1;
},
'normal.mousewheel readonly.mousewheel': function(e) { 'normal.mousewheel readonly.mousewheel': function(e) {
if (!e.originEvent.ctrlKey) return; if (!e.originEvent.ctrlKey) return;
var delta = e.originEvent.wheelDelta; var delta = e.originEvent.wheelDelta;
......
...@@ -10,14 +10,11 @@ if (!kity.Browser.ie) { ...@@ -10,14 +10,11 @@ if (!kity.Browser.ie) {
fileDescription: 'PNG 图片', fileDescription: 'PNG 图片',
fileExtension: '.png', fileExtension: '.png',
encode: function(json, km) { encode: function(json, km) {
var paper = km.getPaper(); var originZoom = km._zoomValue;
var viewport = paper.getViewPort();
var originZoom = viewport.zoom;
viewport.zoom = 1; var paper = km.getPaper(),
paper.setViewPort(viewport); paperTransform = paper.shapeNode.getAttribute('transform'),
domContainer = paper.container,
var domContainer = km.getPaper().container,
svgXml, svgXml,
$svg, $svg,
...@@ -27,27 +24,27 @@ if (!kity.Browser.ie) { ...@@ -27,27 +24,27 @@ if (!kity.Browser.ie) {
renderContainer = km.getRenderContainer(), renderContainer = km.getRenderContainer(),
renderBox = renderContainer.getRenderBox(), renderBox = renderContainer.getRenderBox(),
transform = renderContainer.getTransform(), width = renderBox.width + 1,
width = renderBox.width, height = renderBox.height + 1,
height = renderBox.height,
padding = 20, padding = 20,
canvas = document.createElement('canvas'), canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d'), ctx = canvas.getContext('2d'),
blob, DomURL, url, img, finishCallback; blob, DomURL, url, img, finishCallback;
paper.shapeNode.setAttribute('transform', 'translate(0.5, 0.5)');
renderContainer.translate(-renderBox.x, -renderBox.y); renderContainer.translate(-renderBox.x, -renderBox.y);
svgXml = km.getPaper().container.innerHTML; svgXml = paper.container.innerHTML;
renderContainer.translate(renderBox.x, renderBox.y); renderContainer.translate(renderBox.x, renderBox.y);
viewport.zoom = originZoom;
paper.setViewPort(viewport); paper.shapeNode.setAttribute('transform', paperTransform);
$svg = $(svgXml).filter('svg'); $svg = $(svgXml).filter('svg');
$svg.attr({ $svg.attr({
width: renderBox.width, width: renderBox.width + 1,
height: renderBox.height, height: renderBox.height + 1,
style: 'font-family: Arial, "Microsoft Yahei","Heiti SC";' style: 'font-family: Arial, "Microsoft Yahei","Heiti SC";'
}); });
......
...@@ -6,14 +6,9 @@ if (!kity.Browser.ie) { ...@@ -6,14 +6,9 @@ if (!kity.Browser.ie) {
fileExtension: '.svg', fileExtension: '.svg',
mineType: 'image/svg+xml', mineType: 'image/svg+xml',
encode: function(json, km) { encode: function(json, km) {
var paper = km.getPaper();
var viewport = paper.getViewPort();
var originZoom = viewport.zoom;
viewport.zoom = 1; var paper = km.getPaper(),
paper.setViewPort(viewport); paperTransform = paper.shapeNode.getAttribute('transform'),
var domContainer = km.getPaper().container,
svgXml, svgXml,
$svg, $svg,
...@@ -24,13 +19,15 @@ if (!kity.Browser.ie) { ...@@ -24,13 +19,15 @@ if (!kity.Browser.ie) {
height = renderBox.height, height = renderBox.height,
padding = 20; padding = 20;
paper.shapeNode.setAttribute('transform', 'translate(0.5, 0.5)');
svgXml = km.getPaper().container.innerHTML; svgXml = km.getPaper().container.innerHTML;
paper.shapeNode.setAttribute('transform', paperTransform);
$svg = $(svgXml).filter('svg'); $svg = $(svgXml).filter('svg');
$svg.attr({ $svg.attr({
width: width + padding * 2 | 0, width: width + padding * 2 | 0,
height: height + padding * 2 | 0, height: height + padding * 2 | 0,
style: 'font-family: Arial, "Microsoft Yahei", "Heiti SC";' style: 'font-family: Arial, "Microsoft Yahei", "Heiti SC"; background: ' + km.getStyle('background')
}); });
$svg[0].setAttribute('viewBox', [renderBox.x - padding | 0, $svg[0].setAttribute('viewBox', [renderBox.x - padding | 0,
renderBox.y - padding | 0, renderBox.y - padding | 0,
...@@ -42,8 +39,6 @@ if (!kity.Browser.ie) { ...@@ -42,8 +39,6 @@ if (!kity.Browser.ie) {
svgXml = $('<div></div>').append($svg).html(); svgXml = $('<div></div>').append($svg).html();
svgXml = $('<div></div>').append($svg).html(); svgXml = $('<div></div>').append($svg).html();
viewport.zoom = originZoom;
paper.setViewPort(viewport);
// svg 含有 &nbsp; 符号导出报错 Entity 'nbsp' not defined // svg 含有 &nbsp; 符号导出报错 Entity 'nbsp' not defined
svgXml = svgXml.replace(/&nbsp;/g, '&#xa0;'); svgXml = svgXml.replace(/&nbsp;/g, '&#xa0;');
......
KityMinder.registerTemplate('structure', { KityMinder.registerTemplate('structure', {
name: '组织结构图',
getLayout: function(node) { getLayout: function(node) {
return 'bottom';
}
});
KityMinder.registerTemplate('filetree', {
getLayout: function(node) {
if (node.getData('layout')) return node.getData('layout'); if (node.getData('layout')) return node.getData('layout');
if (node.isRoot()) return 'bottom'; if (node.isRoot()) return 'bottom';
......
KityMinder.registerTheme('classic', { KityMinder.registerTheme('classic', {
'background': 'url(themes/default/images/grid.png) repeat', 'background': '#3A4144 url(themes/default/images/grid.png) repeat',
'root-color': '#430', 'root-color': '#430',
'root-background': '#e9df98', 'root-background': '#e9df98',
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
'drop-hint-color': hsl(h, 26, 35), 'drop-hint-color': hsl(h, 26, 35),
'drop-hint-width': 5, 'drop-hint-width': 5,
'order-hint-area-color': hsl(h, 100, 95).set('a', 0.5), 'order-hint-area-color': hsl(h, 100, 30).set('a', 0.5),
'order-hint-path-color': hsl(h, 100, 25), 'order-hint-path-color': hsl(h, 100, 25),
'order-hint-path-width': 1, 'order-hint-path-width': 1,
......
KityMinder.registerTheme('snow', { KityMinder.registerTheme('snow', {
'background': 'url(themes/default/images/grid.png) repeat', 'background': '#3A4144 url(themes/default/images/grid.png) repeat',
'root-color': '#430', 'root-color': '#430',
'root-background': '#e9df98', 'root-background': '#e9df98',
...@@ -41,9 +41,7 @@ KityMinder.registerTheme('snow', { ...@@ -41,9 +41,7 @@ KityMinder.registerTheme('snow', {
'marquee-stroke': 'white', 'marquee-stroke': 'white',
'drop-hint-color': 'yellow', 'drop-hint-color': 'yellow',
'sub-drop-hint-width': 2, 'drop-hint-width': 4,
'main-drop-hint-width': 4,
'root-drop-hint-width': 4,
'order-hint-area-color': 'rgba(0, 255, 0, .5)', 'order-hint-area-color': 'rgba(0, 255, 0, .5)',
'order-hint-path-color': '#0f0', 'order-hint-path-color': '#0f0',
......
...@@ -2,13 +2,21 @@ ...@@ -2,13 +2,21 @@
html, body, div { html, body, div {
margin: 0; margin: 0;
padding: 0; padding: 0;
/* background: #FFFFFF; */ margin-top: 0 !important;
} }
html, body, #kityminder, div.kmui-editor-body { html, body, #kityminder, div.kmui-editor-body {
overflow: hidden; overflow: hidden;
-moz-user-select: none; -moz-user-select: none;
width: 100%;
}
#content-wrapper {
overflow: hidden;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
} }
#title, #panel { #title, #panel {
background: hsl(224, 16%, 27%); background: hsl(224, 16%, 27%);
font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei'; font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei';
...@@ -61,7 +69,6 @@ html, body, #kityminder, div.kmui-editor-body { ...@@ -61,7 +69,6 @@ html, body, #kityminder, div.kmui-editor-body {
#menu { #menu {
float: left; float: left;
flo
} }
#panel button:hover, #panel button.active { #panel button:hover, #panel button.active {
...@@ -258,7 +265,7 @@ svg, body { ...@@ -258,7 +265,7 @@ svg, body {
font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif; font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif;
} }
#about { #about {
position:absolute; position: absolute;
bottom: 0; bottom: 0;
right: 0; right: 0;
height: 40px; height: 40px;
...@@ -266,14 +273,12 @@ svg, body { ...@@ -266,14 +273,12 @@ svg, body {
background: #5d697a; background: #5d697a;
color: #eee; color: #eee;
font-family:Arial; font-family:Arial;
font-size:13px; font-size: 13px;
font-weight:normal; font-weight:normal;
margin:0; margin:0;
text-align: right; text-align: right;
padding: 0 15px 0 60px; padding: 0 15px 0 60px;
border-bottom: 5px solid #393F4F; border-bottom: 5px solid #393F4F;
-webkit-font-smoothing: antialiased;
position: absolute;
transition: all ease .3s 0.3s; transition: all ease .3s 0.3s;
......
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