Commit f8dc2e4d authored by techird's avatar techird

体验优化

parent 2f0d4154
...@@ -72,7 +72,7 @@ module.exports = function (grunt) { ...@@ -72,7 +72,7 @@ module.exports = function (grunt) {
copy: { copy: {
dir: { dir: {
files: [{ files: [{
src: ['dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html'], src: ['dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html', 'download.php'],
dest: distPath dest: distPath
}] }]
}, },
......
( function ( utils ) { (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>';
content += '.kmui-dialog-<%= container %> input{'; content += '.kmui-dialog-<%= container %> input{';
content += 'width: 75%;'; content += 'width: 74%;';
content += 'padding: 6px 12px;'; content += 'padding: 6px 12px;';
content += 'font-size: 14px;'; content += 'font-size: 14px;';
content += 'line-height: 1.42857143;'; content += 'line-height: 1.42857143;';
...@@ -35,36 +35,51 @@ ...@@ -35,36 +35,51 @@
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, utils.extend( { html = $.parseTmpl(this.tpl, utils.extend({
'container': 'hyperlink' 'container': 'hyperlink'
}, lang ) ); }, lang));
} }
this.root().html( html ); this.root().html(html);
}, },
initEvent: function ( km, $w ) { initEvent: function(km, $w) {
$w.find( '#hyperlink_insert' ).on( 'click', function () { var $btn = $w.find('#hyperlink_insert');
km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() ); $btn.attr('disabled', 'disabled');
var $href = $w.find('#hyperlink_href').on('input', function() {
var url = $href.val();
if (!/^https?\:\/\/(\w+\.)+\w+/.test(url)) {
$href.css('color', 'red');
$href.data('error', true);
$btn.attr('disabled', 'disabled');
} else {
$href.css('color', 'black');
$href.data('error', false);
$btn.removeAttr('disabled');
}
});
$btn.on('click', function() {
if ($btn.attr('disabled')) return;
var url = $w.find('#hyperlink_href').val();
km.execCommand('hyperlink', url);
$w.kmui().hide(); $w.kmui().hide();
} ); });
$w.find( '#hyperlink_href' ).on( 'keydown', function ( e ) { $w.find('#hyperlink_href').on('keydown', function(e) {
if ( e.keyCode === 13 ) { if (e.keyCode === 13) {
km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() ); $btn.click();
$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://');
setTimeout( function () { setTimeout(function() {
$input.focus() $input.select();
} ) });
}, },
width: 400 width: 400
} ); });
} )( KM.Utils ); })(KM.Utils);
\ No newline at end of file \ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
var content = '<div class="image-content" style="padding:20px;width:360px;">'; var content = '<div class="image-content" style="padding:20px;width:360px;">';
content += '<style>'; content += '<style>';
content += '.kmui-dialog-<%= container %> input{'; content += '.kmui-dialog-<%= container %> input{';
content += 'width: 75%;'; content += 'width: 74%;';
content += 'padding: 6px 12px;'; content += 'padding: 6px 12px;';
content += 'font-size: 14px;'; content += 'font-size: 14px;';
content += 'line-height: 1.42857143;'; content += 'line-height: 1.42857143;';
...@@ -49,24 +49,39 @@ ...@@ -49,24 +49,39 @@
this.root().html(html); this.root().html(html);
}, },
initEvent: function(km, $w) { initEvent: function(km, $w) {
$w.find('#image_insert').on('click', function() { var $btn = $w.find('#image_insert').attr('disabled', 'disabled');
km.execCommand('image', $w.find('#image_href').val()); var $href = $w.find('#image_href').on('input', function() {
var url = $href.val();
if (!/^https?\:\/\/(\w+\.)+\w+/.test(url)) {
$href.css('color', 'red');
$href.data('error', true);
} else {
$href.css('color', 'black');
$href.data('error', false);
}
$w.find('#image_preview').attr('src', $href.val());
});
$w.find('#image_preview').on('load', function() {
$btn.removeAttr('disabled');
}).on('error', function() {
$btn.attr('disabled', 'disabled');
});
$btn.on('click', function() {
if ($btn.attr('disabled')) return;
km.execCommand('image', $href.val());
$w.kmui().hide(); $w.kmui().hide();
}); });
$w.find('#image_href').on('keydown', function(e) { $href.on('keydown', function(e) {
if (e.keyCode === 13) { if (e.keyCode === 13) {
km.execCommand('image', $w.find('#image_href').val()); $btn.click();
$w.kmui().hide();
} }
}).on('input', function() {
$w.find('#image_preview').attr('src', $w.find('#image_href').val());
}); });
var url = km.queryCommandValue('image'); var url = km.queryCommandValue('image');
var $input = $w.find('#image_href'); var $input = $w.find('#image_href');
$input.val(url || 'http://'); $input.val(url || 'http://');
if (url) $w.find('#image_preview').attr('src', url); if (url) $w.find('#image_preview').attr('src', url);
setTimeout(function() { setTimeout(function() {
$input.focus(); $input.select();
}); });
}, },
width: 400 width: 400
......
<?php
/**
* 导出文件代理
*
* @author Jinqn, techird
*/
$type = $_REQUEST['type'];
if (isset($_REQUEST['content'])) {
$content = $_REQUEST['content'];
if ($type == 'base64') {
$content = base64_decode($content);
}
$filename = htmlspecialchars($_REQUEST["filename"]);
if (!$filename) {
$filename = "kikyminder";
}
header("Content-type: application/octet-stream; charset=utf-8; name=".$filename);
header("Accept-Length: ".strlen($content));
header("Content-Length: ".strlen($content));
header("Content-Disposition: attachment; filename=".$filename);
header('Content-Description: File Transfer');
echo $content;
} else {
echo 'Empty Content!';
}
?>
\ No newline at end of file
...@@ -6,27 +6,26 @@ ...@@ -6,27 +6,26 @@
<meta name="keyword" content="脑图,kity,svg,minder,百度,fex,前端,在线"> <meta name="keyword" content="脑图,kity,svg,minder,百度,fex,前端,在线">
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。"> <meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<script src="lib/jquery-2.1.0.min.js?_=1404368123769" charset="utf-8"></script>
<script src="lib/jquery-2.1.0.min.js?_=1403688582922" charset="utf-8"></script> <script src="lib/ZeroClipboard.min.js?_=1404368123769" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1403688582922" 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?_=1403688582922" charset="utf-8"></script> <script src="lib/kity.min.js?_=1404368123769" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1403688582922" charset="utf-8"></script> <script src="kityminder.all.min.js?_=1404368123769" charset="utf-8"></script>
<script src="kityminder.config.js?_=1403688582922" charset="utf-8"></script> <script src="kityminder.config.js?_=1404368123769" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1403688582922" charset="utf-8"></script> <script src="lang/zh-cn/zh-cn.js?_=1404368123769" charset="utf-8"></script>
<script src="lib/zip.js?_=1403688582922" charset="utf-8"></script> <script src="lib/zip.js?_=1404368123769" charset="utf-8"></script>
<script> <script>
zip.inflateJSPath = 'lib/inflate.js'; zip.inflateJSPath = 'lib/inflate.js';
</script> </script>
<script src="lib/jquery.xml2json.js?_=1403688582922" charset="utf-8"></script> <script src="lib/jquery.xml2json.js?_=1404368123769" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1403688582922" charset="utf-8"></script> <script src="lib/baidu-frontia-js-full-1.0.0.js?_=1404368123769" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1403688582922" charset="utf-8"></script> <script src="social/draftmanager.js?_=1404368123769" charset="utf-8"></script>
<script src="social/social.js?_=1403688582922" charset="utf-8"></script> <script src="social/social.js?_=1404368123769" 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" />
...@@ -35,7 +34,10 @@ ...@@ -35,7 +34,10 @@
</head> </head>
<body> <body>
<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>
...@@ -52,14 +54,49 @@ ...@@ -52,14 +54,49 @@
</p> </p>
</div> </div>
<p id="about"> <div id="about">
KityMinder <a id="km-version" href="https://github.com/fex-team/kityminder/blob/dev/CHANGELOG.md" target="blank"></a> under <a href="https://raw.githubusercontent.com/fex-team/kityminder/dev/LICENSE" target="_blank">BSD License</a>. Powered by f-cube, <a href="http://fex.baidu.com" target="_blank">FEX</a> | <svg id="km-cat" viewBox="0 0 1200 1200" width="32px" height="32px">
<a href="https://github.com/fex-team/kityminder.git" target="_blank">Source</a> <g id="cat-face">
<a href="https://github.com/fex-team/kityminder/issues/new" target="_blank">Bug</a> | <path d="M1066.769,368.482L1119.5,80L830,131.611C760.552,97.29,682.35,77.999,599.641,77.999
<a href="mailto:kity@baidu.com" target="_blank">Contact Us</a> c-82.424,0-160.371,19.161-229.641,53.26L81,81l50.769,289l0,0c-33.792,69.019-52.77,146.612-52.77,228.641
</p> c0,287.542,233.099,520.642,520.642,520.642s520.642-233.099,520.642-520.642C1120.282,516.011,1101.028,437.88,1066.769,368.482z"
<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> />
</g>
<g id="cat-eye">
<path style="fill:#FFFFFF;" d="M920.255,371C794.746,371,693,472.746,693,598.255s101.746,227.255,227.255,227.255
s227.255-101.746,227.255-227.255S1045.765,371,920.255,371z M920,746c-80.081,0-145-64.919-145-145s64.919-145,145-145
s145,64.919,145,145S1000.081,746,920,746z"/>
<path style="fill:#FFFFFF;" d="M276.255,371C150.746,371,49,472.746,49,598.255s101.746,227.255,227.255,227.255
s227.255-101.746,227.255-227.255S401.765,371,276.255,371z M276,745c-80.081,0-145-64.919-145-145s64.919-145,145-145
s145,64.919,145,145S356.081,745,276,745z"/>
</g>
</svg>
KityMinder
<a id="km-version"
href="https://github.com/fex-team/kityminder/blob/dev/CHANGELOG.md"
target="blank">
</a>
under
<a href="https://raw.githubusercontent.com/fex-team/kityminder/dev/LICENSE"
target="_blank">BSD License
</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>
</div>
</body> </body>
<!--脑图启动代码-->
<script> <script>
// create km instance // create km instance
km = KM.getKityMinder('kityminder'); km = KM.getKityMinder('kityminder');
...@@ -70,32 +107,34 @@ ...@@ -70,32 +107,34 @@
var lastVersion = localStorage.lastKMVersion; var lastVersion = localStorage.lastKMVersion;
$('#km-version').text( 'v' + KM.version ); $('#km-version').text( 'v' + KM.version );
if( lastVersion != KM.version ) { if (lastVersion != KM.version) {
$( '#km-version' ).addClass( 'new-version' ); $( '#km-version' ).addClass( 'new-version' );
localStorage.lastKMVersion = KM.version; localStorage.lastKMVersion = KM.version;
} }
}); });
km.on('unziperror', function(ev){ km.on('unziperror', function(ev) {
alert('unziperror'); alert('unziperror');
}); });
km.on('parseerror', function(ev){ km.on('parseerror', function(ev) {
alert('parseerror'); alert('parseerror');
}); });
km.on('unknownprotocal', function(ev){ km.on('unknownprotocal', function(ev) {
alert('unknownprotocal'); alert('unknownprotocal');
}); });
</script> </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>
<!--Baidu Tongji Code--> <!--Baidu Tongji Code-->
<script type="text/javascript"> <script type="text/javascript">
if (document.domain == 'naotu.baidu.com') { if (document.domain == 'naotu.baidu.com') {
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://"); 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")); 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 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.
...@@ -63,14 +63,14 @@ ...@@ -63,14 +63,14 @@
'KITYMINDER_HOME_URL': getKMBasePath(), 'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏 //定义工具栏
toolbars: [ toolbars: [
'hand | zoom-in zoom zoom-out | collapsenode expandnode | undo redo | bold italic | fontfamily fontsize forecolor | saveto | hyperlink unhyperlink image removeimage | markers resource | node | help' 'undo redo | template theme | fontfamily fontsize bold italic forecolor | node hyperlink unhyperlink image removeimage markers resource | collapsenode expandnode | hand zoom-in zoom zoom-out | help'
] ]
//只读模式,默认是false //只读模式,默认是false
//readOnly: true //readOnly: true
//设置主题 //设置主题
//,defaultlayoutstyle : 'default' //设置默认的主题 //,defaultTemplate : 'default' //设置默认的主题
//,layoutstyle : [] //添加有那些主图 //,defaultTheme : 'fresh-blue' //添加有那些主图
//回退相关选项 //回退相关选项
//,maxUndoCount:20 //最大可回退的次数,默认20 //,maxUndoCount:20 //最大可回退的次数,默认20
......
KityMinder.LANG['zh-cn'] = { KityMinder.LANG['zh-cn'] = {
'template': {
'default': '思维导图',
'structure': '组织结构图'
},
'theme': {
'classic': '脑图经典',
'snow': '温柔冷光',
'fresh-red': '清新红',
'fresh-soil': '泥土黄',
'fresh-green': '文艺绿',
'fresh-blue': '天空蓝',
'fresh-purple': '浪漫紫',
'fresh-pink': '脑残粉'
},
'maintopic': '中心主题', 'maintopic': '中心主题',
'topic': '分支主题', 'topic': '分支主题',
'tooltips': { 'tooltips': {
...@@ -21,9 +35,11 @@ KityMinder.LANG['zh-cn'] = { ...@@ -21,9 +35,11 @@ KityMinder.LANG['zh-cn'] = {
'preference': '偏好设置', 'preference': '偏好设置',
'image': '插入图片', 'image': '插入图片',
'hyperlink': '插入链接', 'hyperlink': '插入链接',
'unhyperlink': "删除链接", 'unhyperlink': '删除链接',
'expandnode': "展开节点", 'expandnode': '展开节点',
'collapsenode': "收起节点" 'collapsenode': '收起节点',
'template': '模板',
'theme': '皮肤'
}, },
'popupcolor': { 'popupcolor': {
'clearColor': '清空颜色', 'clearColor': '清空颜色',
...@@ -72,11 +88,17 @@ KityMinder.LANG['zh-cn'] = { ...@@ -72,11 +88,17 @@ KityMinder.LANG['zh-cn'] = {
}, },
'hyperlink': { 'hyperlink': {
'hyperlink': '插入超链接', 'hyperlink': '插入超链接',
'unhyperlink': "取消超链接" 'unhyperlink': '取消超链接'
}, },
'image': { 'image': {
'image': '插入图片', 'image': '插入图片',
'removeimage': '删除图片' 'removeimage': '删除图片'
},
'marker': {
'marker': '设置进度/优先级'
},
'resource': {
'resource': '设置资源'
} }
}; };
\ No newline at end of file
/*! /*!
* ==================================================== * ====================================================
* kity - v2.0.0 - 2014-06-23 * kity - v2.0.0 - 2014-07-01
* 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
...@@ -177,9 +177,19 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat ...@@ -177,9 +177,19 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat
var queue = this._KityAnimateQueue; var queue = this._KityAnimateQueue;
if (queue) { if (queue) {
while (queue.length) { while (queue.length) {
queue.shift().stop(); queue.shift().t.stop();
} }
} }
return this;
},
pause: function() {
var queue = this._KityAnimateQueue;
if (queue) {
while (queue.length) {
queue.shift().t.pause();
}
}
return this;
} }
}); });
return Animator; return Animator;
...@@ -1668,6 +1678,9 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) { ...@@ -1668,6 +1678,9 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) {
var xMin = Math.min(this.x, another.x), xMax = Math.max(this.right, another.right), yMin = Math.min(this.y, another.y), yMax = Math.max(this.bottom, another.bottom); var xMin = Math.min(this.x, another.x), xMax = Math.max(this.right, another.right), yMin = Math.min(this.y, another.y), yMax = Math.max(this.bottom, another.bottom);
return new Box(xMin, yMin, xMax - xMin, yMax - yMin); return new Box(xMin, yMin, xMax - xMin, yMax - yMin);
}, },
expand: function(ex, ey, ew, eh) {
return new Box(this.x + ex, this.y + ey, this.width - ex + ew, this.height - ey + eh);
},
valueOf: function() { valueOf: function() {
return [ this.x, this.y, this.width, this.height ]; return [ this.x, this.y, this.width, this.height ];
}, },
...@@ -3541,7 +3554,7 @@ define("graphic/group", [ "graphic/shapecontainer", "graphic/container", "core/u ...@@ -3541,7 +3554,7 @@ define("graphic/group", [ "graphic/shapecontainer", "graphic/container", "core/u
return require("core/class").createClass("Group", { return require("core/class").createClass("Group", {
mixins: [ ShapeContainer ], mixins: [ ShapeContainer ],
base: require("graphic/shape"), base: require("graphic/shape"),
constructor: function() { constructor: function Group() {
this.callBase("g"); this.callBase("g");
} }
}); });
...@@ -4009,39 +4022,40 @@ define("graphic/matrix", [ "core/utils", "graphic/box", "core/class", "graphic/p ...@@ -4009,39 +4022,40 @@ define("graphic/matrix", [ "core/utils", "graphic/box", "core/class", "graphic/p
e: 0, e: 0,
f: 0 f: 0
}; };
var node = target.shapeNode || target.node;
refer = refer || "parent"; refer = refer || "parent";
// 根据参照坐标系选区的不一样,返回不同的结果 // 根据参照坐标系选区的不一样,返回不同的结果
switch (refer) { switch (refer) {
case "screen": case "screen":
// 以浏览器屏幕为参照坐标系 // 以浏览器屏幕为参照坐标系
ctm = target.node.getScreenCTM(); ctm = node.getScreenCTM();
break; break;
case "doc": case "doc":
case "paper": case "paper":
// 以文档(Paper)为参照坐标系 // 以文档(Paper)为参照坐标系
ctm = target.node.getCTM(); ctm = node.getCTM();
break; break;
case "view": case "view":
case "top": case "top":
// 以顶层绘图容器(视野)为参照坐标系 // 以顶层绘图容器(视野)为参照坐标系
if (target.getPaper()) { if (target.getPaper()) {
ctm = target.node.getTransformToElement(target.getPaper().shapeNode); ctm = node.getTransformToElement(target.getPaper().shapeNode);
} }
break; break;
case "parent": case "parent":
// 以父容器为参照坐标系 // 以父容器为参照坐标系
if (target.node.parentNode) { if (target.node.parentNode) {
ctm = target.node.getTransformToElement(target.node.parentNode); ctm = node.getTransformToElement(target.node.parentNode);
} }
break; break;
default: default:
// 其他情况,指定参照物 // 其他情况,指定参照物
if (refer.node) { if (refer.node) {
ctm = target.node.getTransformToElement(refer.shapeNode || refer.node); ctm = node.getTransformToElement(refer.shapeNode || refer.node);
} }
} }
return ctm ? new Matrix(ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f) : new Matrix(); return ctm ? new Matrix(ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f) : new Matrix();
...@@ -4292,6 +4306,9 @@ define("graphic/paper", [ "core/class", "core/utils", "graphic/svg", "graphic/co ...@@ -4292,6 +4306,9 @@ define("graphic/paper", [ "core/class", "core/utils", "graphic/svg", "graphic/co
} }
return parent; return parent;
}, },
isAttached: function() {
return !!this.getPaper();
},
whenPaperReady: function(fn) { whenPaperReady: function(fn) {
var me = this; var me = this;
function check() { function check() {
...@@ -4758,7 +4775,7 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b ...@@ -4758,7 +4775,7 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b
return Math.min(minValue, radius); return Math.min(minValue, radius);
} }
}); });
return require("core/class").createClass("Rect", { var Rect = require("core/class").createClass("Rect", {
base: require("graphic/path"), base: require("graphic/path"),
constructor: function(width, height, x, y, radius) { constructor: function(width, height, x, y, radius) {
this.callBase(); this.callBase();
...@@ -4861,6 +4878,7 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b ...@@ -4861,6 +4878,7 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b
return this.update(); return this.update();
} }
}); });
return Rect;
}); });
define("graphic/regularpolygon", [ "graphic/point", "core/class", "graphic/path", "core/utils", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) { define("graphic/regularpolygon", [ "graphic/point", "core/class", "graphic/path", "core/utils", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) {
var Point = require("graphic/point"); var Point = require("graphic/point");
...@@ -4949,7 +4967,7 @@ define("graphic/shape", [ "graphic/svg", "core/utils", "graphic/eventhandler", " ...@@ -4949,7 +4967,7 @@ define("graphic/shape", [ "graphic/svg", "core/utils", "graphic/eventhandler", "
var Box = require("graphic/box"); var Box = require("graphic/box");
var Shape = require("core/class").createClass("Shape", { var Shape = require("core/class").createClass("Shape", {
mixins: [ EventHandler, Styled, Data ], mixins: [ EventHandler, Styled, Data ],
constructor: function(tagName) { constructor: function Shape(tagName) {
this.node = svg.createNode(tagName); this.node = svg.createNode(tagName);
this.node.shape = this; this.node.shape = this;
this.transform = { this.transform = {
...@@ -5198,6 +5216,10 @@ define("graphic/shapecontainer", [ "graphic/container", "core/class", "core/util ...@@ -5198,6 +5216,10 @@ define("graphic/shapecontainer", [ "graphic/container", "core/class", "core/util
addShape: function(shape, index) { addShape: function(shape, index) {
return this.addItem(shape, index); return this.addItem(shape, index);
}, },
put: function(shape) {
this.addShape(shape);
return shape;
},
appendShape: function(shape) { appendShape: function(shape) {
return this.addShape(shape); return this.addShape(shape);
}, },
...@@ -5347,10 +5369,12 @@ define("graphic/shapeevent", [ "graphic/matrix", "core/utils", "graphic/box", "g ...@@ -5347,10 +5369,12 @@ define("graphic/shapeevent", [ "graphic/matrix", "core/utils", "graphic/box", "g
return null; return null;
} }
var eventClient = this.originEvent.touches ? this.originEvent.touches[touchIndex || 0] : this.originEvent; var eventClient = this.originEvent.touches ? this.originEvent.touches[touchIndex || 0] : this.originEvent;
var clientX = eventClient && eventClient.clientX || 0, clientY = eventClient && eventClient.clientY || 0, node = this.targetShape.shapeNode || this.targetShape.node, // 鼠标位置在目标对象上的坐标 var target = this.targetShape;
// 基于屏幕坐标算 var targetNode = target.shapeNode || target.node;
point = Matrix.transformPoint(clientX, clientY, node.getScreenCTM().inverse()); var pScreen = new kity.Point(eventClient && eventClient.clientX || 0, eventClient && eventClient.clientY || 0);
return Matrix.getCTM(this.targetShape, refer || "view").transformPoint(point); var pTarget = Matrix.transformPoint(pScreen, targetNode.getScreenCTM().inverse());
var pRefer = Matrix.getCTM(target, refer || "view").transformPoint(pTarget);
return pRefer;
}, },
stopPropagation: function() { stopPropagation: function() {
var evt = this.originEvent; var evt = this.originEvent;
...@@ -5770,10 +5794,10 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", " ...@@ -5770,10 +5794,10 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
var TextContent = require("graphic/textcontent"); var TextContent = require("graphic/textcontent");
var ShapeContainer = require("graphic/shapecontainer"); var ShapeContainer = require("graphic/shapecontainer");
var svg = require("graphic/svg"); var svg = require("graphic/svg");
var utils = require("core/utils");
var offsetHash = {}; var offsetHash = {};
function getTextBoundOffset(text) { function getTextBoundOffset(text) {
var style = window.getComputedStyle(text.node); var font = text._cachedFontHash;
var font = [ style.fontFamily, style.fontSize, style.fontStretch, style.fontStyle, style.fontVariant, style.fontWeight ].join("-");
if (offsetHash[font]) { if (offsetHash[font]) {
return offsetHash[font]; return offsetHash[font];
} }
...@@ -5796,6 +5820,22 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", " ...@@ -5796,6 +5820,22 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
if (content !== undefined) { if (content !== undefined) {
this.setContent(content); this.setContent(content);
} }
this._buildFontHash();
},
_buildFontHash: function() {
var style = window.getComputedStyle(this.node);
this._cachedFontHash = [ style.fontFamily, style.fontSize, style.fontStretch, style.fontStyle, style.fontVariant, style.fontWeight ].join("-");
},
_fontChanged: function(font) {
var last = this._lastFont;
var current = utils.extend({}, last, font);
if (!last) {
last = font;
return true;
}
var changed = last.family != current.family || last.size != current.size || last.style != current.style || last.weight != current.weight;
last = current;
return changed;
}, },
setX: function(x) { setX: function(x) {
this.node.setAttribute("x", x); this.node.setAttribute("x", x);
...@@ -5816,7 +5856,11 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", " ...@@ -5816,7 +5856,11 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
}, },
setFont: function(font) { setFont: function(font) {
this.callBase(font); this.callBase(font);
return this.setVerticalAlign(this.getVerticalAlign()); if (this._fontChanged(font)) {
this._buildFontHash();
this.setVerticalAlign(this.getVerticalAlign());
}
return this;
}, },
setTextAnchor: function(anchor) { setTextAnchor: function(anchor) {
this.node.setAttribute("text-anchor", anchor); this.node.setAttribute("text-anchor", anchor);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -9,27 +9,6 @@ function DraftManager( minder ) { ...@@ -9,27 +9,6 @@ function DraftManager( minder ) {
function init() { function init() {
drafts = localStorage.getItem( 'drafts' ); drafts = localStorage.getItem( 'drafts' );
drafts = drafts ? JSON.parse( drafts ) : []; drafts = drafts ? JSON.parse( drafts ) : [];
loadDraftForOldVersion();
}
/**
* @todo 1.2 版本中删除该方法
*
* 加载老版本的草稿
*/
function loadDraftForOldVersion() {
var path = localStorage.getItem( 'draft_filename' ),
data = localStorage.getItem( 'draft_data' );
if ( path && data ) {
drafts.push( {
path: path,
data: data,
name: JSON.parse( data ).data.text,
update: new Date()
} );
localStorage.removeItem( 'draft_filename' );
localStorage.removeItem( 'draft_data' );
}
} }
function store() { function store() {
...@@ -58,7 +37,7 @@ function DraftManager( minder ) { ...@@ -58,7 +37,7 @@ function DraftManager( minder ) {
function load() { function load() {
if ( current ) { if ( current ) {
minder.importData( current.data, "json" ); minder.importData( current.data, 'json' );
} }
return current; return current;
} }
...@@ -80,8 +59,9 @@ function DraftManager( minder ) { ...@@ -80,8 +59,9 @@ function DraftManager( minder ) {
} else { } else {
current.path = path || current.path; current.path = path || current.path;
current.name = minder.getMinderTitle(); current.name = minder.getMinderTitle();
current.data = minder.exportData( "json" ); var data = minder.exportData( 'json' );
current.sync = false; current.sync = current.sync && (data == current.data);
current.data = data;
current.update = new Date(); current.update = new Date();
store(); store();
} }
......
This diff is collapsed.
This diff is collapsed.
#social { .niceblue {
position: absolute; color: white;
right: 10px; background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
top: 10px; background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
line-height: 20px; background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
text-align: right; background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
overflow: hidden; background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
} }
.dropdown { .dropdown {
padding-right: 28px; padding-right: 28px;
position: relative;
&:after { &:after {
content: ' '; content: ' ';
display: block; display: block;
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 15px; top: 12px;
width: 0; width: 0;
height: 0; height: 0;
border: solid; border: solid;
border-width: 4px 5px; border-width: 4px 5px;
border-color: #FFFFFF transparent transparent transparent; border-color: #333 transparent transparent transparent;
}
&:active, &.active {
&:after {
border-color: #fff transparent transparent transparent;
}
} }
} }
...@@ -29,26 +36,19 @@ button { ...@@ -29,26 +36,19 @@ button {
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
padding: 0 15px; padding: 0 15px;
height: 35px; height: 30px;
font-size: 13px; font-size: 13px;
line-height: 35px; line-height: 30px;
text-align: center; text-align: center;
border-radius: 5px; color: #000;
color: #ffffff;
text-decoration: none; text-decoration: none;
border: none; border: none;
margin-left: 5px; margin-left: 5px;
cursor: pointer; background: none;
background: #0099f2; /* Old browsers */ border-radius: 2px;
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=); .niceblue;
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
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: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
&:hover, &.hover { &:hover, &.hover {
background: #009fff; background: #009fff;
} }
...@@ -59,63 +59,14 @@ button { ...@@ -59,63 +59,14 @@ button {
} }
&[disabled] { &[disabled] {
background: #AAA;
cursor: default; cursor: default;
} background: #ccc;
&.baidu-cloud {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/baiducloud.png);
position: absolute;
left: 7px;
top: 5px;
}
}
&.share {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/share.png) no-repeat;
position: absolute;
left: 7px;
top: 5px;
}
}
img {
position: relative;
top: 3px;
border-radius: 2px;
margin-right: 7px;
}
&.user-file {
position: relative;
img {
border: none;
outline: none;
}
span.text {
display: inline-block;
height: 24px;
line-height: 24px;
}
.dropdown;
} }
} }
#draft-btn {
.dropdown; .draft-menu.kmui-dropdown-menu {
} margin-top: 24px;
.draft-menu { margin-left: 1px;
span.update-time { span.update-time {
float: right; float: right;
color: #CCC; color: #CCC;
...@@ -184,17 +135,46 @@ button { ...@@ -184,17 +135,46 @@ button {
} }
} }
} }
.user-file-menu {
margin-top: 20px; .file-menu.kmui-dropdown-menu {
margin-top: 24px;
margin-left: 1px; margin-left: 1px;
border-radius: 4px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3);
#save-button, #manage-file-button {
display: none;
}
&.logined {
#save-button, #manage-file-button{
display: block;
}
#net-hint-buttom {
display: none;
}
}
}
.user-menu.kmui-dropdown-menu {
margin-top: 24px;
margin-left: -25px;
min-width: 130px;
border-radius: 4px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3);
li a {
padding-left: 40px;
}
} }
#share-dialog { #share-dialog {
position: absolute; position: absolute;
padding: 20px; padding: 20px;
border-radius: 4px; border-radius: 4px;
right: 10px; left: 50%;
top: 65px; top: 40%;
margin-left: -175px;
margin-top: -100px;
background: white; background: white;
width: 350px; width: 350px;
box-shadow: 1px 2px 16px rgba(0, 0, 0, .5); box-shadow: 1px 2px 16px rgba(0, 0, 0, .5);
...@@ -233,22 +213,24 @@ button { ...@@ -233,22 +213,24 @@ button {
line-height: 28px; line-height: 28px;
border-radius: 2px; border-radius: 2px;
vertical-align: middle; vertical-align: middle;
color: white;
border-radius: 5px;
.niceblue;
&:hover, &.hover {
background: #009fff;
}
&:active, &.active {
background: darken(#009fff, 10%);
box-shadow: inset 0 2px 3px rgba(0,0,0, .2);
}
} }
#share-platform { #share-platform {
margin-bottom: 0; margin-bottom: 0;
} }
&:before {
position: absolute;
content: ' ';
width: 0;
height: 0;
line-height: 0;
display: block;
border: 10px solid transparent;
border-bottom-color: white;
right: 30px;
top: -20px;
}
} }
\ No newline at end of file
.kmui-modal { .kmui-modal {
position: fixed; position: fixed;
top: 60px; top: 140px;
right:10px; right:10px;
background-color: #ffffff; 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-dropdown-menu { .kmui-dropdown-menu {
position: absolute; position: absolute;
z-index: 1000; z-index: 99999999999;
display: none; display: none;
min-width: 160px; min-width: 160px;
padding: 5px 0; padding: 5px 0;
...@@ -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: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */ background: #5a6378; /* 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,13 +2,213 @@ ...@@ -2,13 +2,213 @@
html, body, div { html, body, div {
margin: 0; margin: 0;
padding: 0; padding: 0;
/* background: #FFFFFF; */
} }
html, body, #kityminder, div.kmui-editor-body { html, body, #kityminder, div.kmui-editor-body {
height: 100%;
width: 100%;
overflow: hidden; overflow: hidden;
-moz-user-select: none; -moz-user-select: none;
} }
#title, #panel {
background: #393F4F;
font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei';
/* -webkit-font-smoothing: antialiased; */
}
#title {
height: 40px;
line-height: 45px;
padding: 0;
margin: 0;
padding: 0;
font-size: 14px;
color: #DBDBDB;
text-align: center;
font-weight: 300;
font-size: 14px;
}
#panel {
height: 40px;
overflow: visible;
padding: 0 15px;
position: relative;
border-bottom: 8px solid #5A6378;
}
#panel button {
font-size: 14px;
height: 24px;
line-height: 28px;
padding-right: 7px;
padding-left: 30px;
cursor: pointer;
color: #a3a6ae;
margin: 0 8px;
background: url(../images/menu-icons.png) no-repeat;
vertical-align: middle;
margin-top: -3px;
}
#menu, #user {
height: 40px;
line-height: 40px;
}
#menu {
float: left;
flo
}
#panel button:hover, #panel button.active {
color: white;
box-shadow: none;
}
button.dropdown {
padding-right: 28px !important;
position: relative;
}
button.dropdown:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 12px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #a3a6ae transparent transparent transparent;
}
button.dropdown:hover:after, button.dropdown.active:after {
border-color: #fff transparent transparent transparent;
}
#file-btn:hover, #file-btn.active {
background-position: 0 -24px;
}
button#tool-btn {
background-position: 0 -48px;
}
#tool-btn:hover, #tool-btn.active {
background-position: 0 -72px;
}
#tool-btn.active:after {
content: ' ';
display: block;
position: absolute;
top: 21px;
left: 40px;
width: 0;
height: 0;
border: solid;
border-width: 11px 11px;
border-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) #FFF rgba(0, 0, 0, 0);
}
#panel button#tool-btn.active {
/* box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 -1px 2px rgba(255, 255, 255, .1); */
/* background-color: #677085; */
/* border: 1px solid #2E2E2E; */
/* padding-top: 10px; */
/* padding-bottom: 10px; */
/* height: 28px; */
/* margin-top: -1px; */
/* margin-left: 7px; */
position: relative;
}
#user {
/* position: absolute; */
/* top: 0; */
/* right: 10px; */
float: right;
}
#user-btn, #logout-btn, #user.logined #login-btn {
display: none;
}
#user.logined #user-btn, #user.logined #logout-btn {
display: inline-block;
}
button#user-btn {
position: relative;
margin-right: 0;
}
button#user-btn, button#login-btn {
background-position: 0 -96px;
}
button#user-btn:hover, button#login-btn:hover,
button#user-btn.active, button#login-btn.active {
background-position: 0 -120px;
}
#user-btn img {
position: absolute;
left: 4px;
top: 4px;
width: 18px;
height: 18px;
/* display: none; */
}
button#logout-btn {
background: none;
margin: none;
padding-left: 0;
}
button#draft-btn {
background-position: 0 -144px;
}
button#draft-btn:hover,
button#draft-btn.active {
background-position: 0 -168px;
}
li#manage-file-button {
position: relative;
}
li#manage-file-button:before {
content: ' ';
display: block;
position: absolute;
width: 24px;
height: 24px;
left: 5px;
background: url(../images/baiducloud.png) no-repeat 3px 0;
}
li#manage-file-button:hover:before {
background-position: 3px -24px;
}
button#share-btn {
background-position: 0 -192px;
}
button#share-btn:hover {
background-position: 0 -216px;
}
#kityminder {
position: absolute;
left: 0;
top: 48px;
right: 0;
bottom: 0;
}
.km_receiver{ .km_receiver{
width:0; width:0;
height:0; height:0;
...@@ -16,34 +216,78 @@ html, body, #kityminder, div.kmui-editor-body { ...@@ -16,34 +216,78 @@ html, body, #kityminder, div.kmui-editor-body {
.km-minderNode{ .km-minderNode{
cursor:default; cursor:default;
} }
.kmui-container { .kmui-container, .kmui-editor-body {
height: 100%; position: absolute;
} left: 0;
.kmui-container { top: 0;
right: 0;
bottom: 0;
} }
.kmui-container .kmui-toolbar{ .kmui-container .kmui-toolbar{
background-color: #fafafa; background-color: #fff;
z-index: 99999; z-index: 999;
margin-right: 400px; }
.kmui-container .kmui-toolbar:after {
} }
.kmui-toolbar .kmui-btn-toolbar{ .kmui-toolbar .kmui-btn-toolbar{
padding: 5px; padding: 5px;
border-bottom: 1px solid #f0f0f0;
} }
.kmui-toolbar { .kmui-toolbar {
position: absolute; position: absolute;
left: 10px; left: 0;
top: 10px; right: 0;
border-radius: 4px; top: 0;
box-shadow: 3px 3px 8px rgba(0,0,0, .5);
} }
.kmui-container .kmui-editor-body { .kmui-container .kmui-editor-body {
background: rgb(50, 60, 61) url(../images/grid.png) repeat; background: #fbfbfb;
/*line-height: 0;*/ /*line-height: 0;*/
overflow: hidden; overflow: hidden;
} }
svg, body { svg, body {
font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif; font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif;
} }
#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} #about {
position:absolute;
bottom: 0;
right: 0;
height: 40px;
line-height: 40px;
background: #5d697a;
color: #eee;
font-family:Arial;
font-size:13px;
font-weight:normal;
margin:0;
text-align: right;
padding: 0 15px 0 60px;
border-bottom: 5px solid #393F4F;
-webkit-font-smoothing: antialiased;
position: absolute;
transition: all ease .3s 0.3s;
-webkit-transform: translate(100%);
}
#about:hover {
-webkit-transform: translate(0);
}
#about a {
color: #eee;
}
#about #km-cat {
position: absolute;
left: 15px;
top: 5px;
transition: all ease 1.3s 0.3s;
-webkit-transform: translate(-60px, 0);
cursor: pointer;
}
#about:hover #km-cat {
-webkit-transform: translate(0);
}
#about #cat-face {
fill: #393F4F;
}
#km-version.new-version{position:relative;padding-right:30px} #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)} #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)}
<svg viewBox="0 0 1200 1200" width="32px" height="32px">
<g id="cat-face">
<path style="fill:#272B2D;" d="M1066.769,368.482L1119.5,80L830,131.611C760.552,97.29,682.35,77.999,599.641,77.999
c-82.424,0-160.371,19.161-229.641,53.26L81,81l50.769,289l0,0c-33.792,69.019-52.77,146.612-52.77,228.641
c0,287.542,233.099,520.642,520.642,520.642s520.642-233.099,520.642-520.642C1120.282,516.011,1101.028,437.88,1066.769,368.482z"
/>
</g>
<g id="cat-eye">
<path style="fill:#FFFFFF;" d="M920.255,371C794.746,371,693,472.746,693,598.255s101.746,227.255,227.255,227.255
s227.255-101.746,227.255-227.255S1045.765,371,920.255,371z M920,746c-80.081,0-145-64.919-145-145s64.919-145,145-145
s145,64.919,145,145S1000.081,746,920,746z"/>
<path style="fill:#FFFFFF;" d="M276.255,371C150.746,371,49,472.746,49,598.255s101.746,227.255,227.255,227.255
s227.255-101.746,227.255-227.255S401.765,371,276.255,371z M276,745c-80.081,0-145-64.919-145-145s64.919-145,145-145
s145,64.919,145,145S356.081,745,276,745z"/>
</g>
</svg>
dist/themes/default/images/share.png

1.14 KB | W: | H:

dist/themes/default/images/share.png

1.46 KB | W: | H:

dist/themes/default/images/share.png
dist/themes/default/images/share.png
dist/themes/default/images/share.png
dist/themes/default/images/share.png
  • 2-up
  • Swipe
  • Onion skin
<?php
/**
* 导出文件代理
*
* @author Jinqn, techird
*/
$type = $_REQUEST['type'];
if (isset($_REQUEST['content'])) {
$content = $_REQUEST['content'];
if ($type == 'base64') {
$content = base64_decode($content);
}
$filename = htmlspecialchars($_REQUEST["filename"]);
if (!$filename) {
$filename = "kikyminder";
}
header("Content-type: application/octet-stream; charset=utf-8; name=".$filename);
header("Accept-Length: ".strlen($content));
header("Content-Length: ".strlen($content));
header("Content-Disposition: attachment; filename=".$filename);
header('Content-Description: File Transfer');
echo $content;
} else {
echo 'Empty Content!';
}
?>
\ No newline at end of file
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
'KITYMINDER_HOME_URL': getKMBasePath(), 'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏 //定义工具栏
toolbars: [ toolbars: [
'hand | zoom-in zoom zoom-out | saveto | collapsenode expandnode | undo redo | template theme | bold italic | fontfamily fontsize forecolor| hyperlink unhyperlink image removeimage | markers resource | node | help' 'undo redo | template theme | fontfamily fontsize bold italic forecolor | node hyperlink unhyperlink image removeimage markers resource | collapsenode expandnode | hand zoom-in zoom zoom-out | help'
] ]
//只读模式,默认是false //只读模式,默认是false
//readOnly: true //readOnly: true
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
/** /**
* 百度脑图社会化功能 * 百度脑图社会化功能
* *
* 1. 百度账号登 * 1. 百度账号登
* 2. 百度云存储 * 2. 百度云存储
* 3. 分享 * 3. 分享
* 4. 草稿箱同步 * 4. 草稿箱同步
...@@ -103,6 +103,67 @@ $(function() { ...@@ -103,6 +103,67 @@ $(function() {
if (draftManager && !loadPath() && !isShareLink) loadDraft(0); if (draftManager && !loadPath() && !isShareLink) loadDraft(0);
} }
function createFileMenu() {
var menus = [{
label: '新建 (Ctrl + N)',
click: newFile
}, {
divider: true
}];
// 导入菜单组
var acceptFiles = [];
KityMinder.getSupportedProtocals().forEach(function(name) {
var p = KityMinder.findProtocal(name);
if (p.decode) {
acceptFiles.push(p.fileExtension);
}
});
menus = menus.concat([{
label: '导入本地文件',
click: function() {
$('<input type="file" />')
.attr('accept', acceptFiles.join(','))
.on('change', function(e) {
e = e.originalEvent;
minder.importFile(e.target.files[0]);
}).click();
}
}, {
divider: true
}]);
// 导出菜单组
KityMinder.getSupportedProtocals().forEach(function(name) {
var p = KityMinder.findProtocal(name);
if (p.encode) {
var text = p.fileDescription + '(' + p.fileExtension + ')';
menus.push({
label: '导出 ' + text,
click: function() {
minder.exportFile(name);
}
});
}
});
menus = menus.concat([{
divider: true,
}, {
label: '登陆',
click: login,
id: 'net-hint-buttom'
}, {
label: '保存到百度云 (Ctrl + S)',
click: save,
id: 'save-button'
}, {
divider: true
}]);
return menus;
}
// 创建 UI // 创建 UI
function initUI() { function initUI() {
$panel = $('#panel'); $panel = $('#panel');
...@@ -113,24 +174,9 @@ $(function() { ...@@ -113,24 +174,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({ $file_menu = $.kmuidropmenu({ data: createFileMenu() })
data: [{ .addClass('file-menu')
label: '新建 (Ctrl + N)', .appendTo('body');
click: newFile
}, {
divider: true,
}, {
label: '登陆',
click: login,
id: 'net-hint-buttom'
}, {
label: '保存到百度云 (Ctrl + S)',
click: save,
id: 'save-button'
}, {
divider: true
}]
}).addClass('file-menu').appendTo('body');
$file_menu.kmui().attachTo($file_btn); $file_menu.kmui().attachTo($file_btn);
...@@ -142,9 +188,8 @@ $(function() { ...@@ -142,9 +188,8 @@ $(function() {
$draft_menu = $.kmuidropmenu().addClass('draft-menu kmui-combobox-menu').appendTo('body'); $draft_menu = $.kmuidropmenu().addClass('draft-menu kmui-combobox-menu').appendTo('body');
$draft_menu.kmui().attachTo($draft_btn); $draft_menu.kmui().attachTo($draft_btn);
$draft_menu.on('aftershow', showDraftList); $draft_menu.on('aftershow', showDraftList);
$tool_btn = $('<button id="tool-btn" title="打开/收起工具箱">工具箱</button>').appendTo($menu);
$tool_btn = $('<button id="tool-btn">工具箱</button>').appendTo($menu);
$tool_btn.click(function() { $tool_btn.click(function() {
var hide = !localStorage.hide_toolbar; var hide = !localStorage.hide_toolbar;
...@@ -160,7 +205,7 @@ $(function() { ...@@ -160,7 +205,7 @@ $(function() {
$login_btn = $('<button id="login-btn">登录</button>').appendTo($user).click(login); $login_btn = $('<button id="login-btn">登录</button>').appendTo($user).click(login);
$user_btn = $('<button id="user-btn">用户</button>').addClass('dropdown').appendTo($user); $user_btn = $('<button id="user-btn">用户</button>').addClass('dropdown').appendTo($user);
$user_menu = $.kmuidropmenu({ $user_menu = $.kmuidropmenu({
data: [{ data: [{
label: '个人中心', label: '个人中心',
...@@ -899,7 +944,7 @@ $(function() { ...@@ -899,7 +944,7 @@ $(function() {
function loadDraft(index) { function loadDraft(index) {
var draft = draftManager.open(index), var draft = draftManager.open(index),
isRemote; isRemote;
if (!draft) return; if (!draft) return;
isRemote = draft.path.indexOf('/apps/kityminder') === 0; isRemote = draft.path.indexOf('/apps/kityminder') === 0;
......
KM.registerToolbarUI('saveto', function(name) { (function() {
var me = this,
label = me.getLang('tooltips.' + name),
options = {
label: label,
title: label,
comboboxName: name,
items: [],
itemStyles: [],
value: [],
autowidthitem: [],
enabledRecord: false,
enabledSelected: false
},
$combox = null,
comboboxWidget = null;
utils.each(KityMinder.getAllRegisteredProtocals(), function(k) {
var p = KityMinder.findProtocal(k);
if (p.encode) {
var text = p.fileDescription + '(' + p.fileExtension + ')';
options.value.push(k);
options.items.push(text);
options.autowidthitem.push($.wordCountAdaptive(text), true);
}
});
//实例化 function doDownload(url, filename, type) {
$combox = $.kmuibuttoncombobox(options).css('zIndex', me.getOptions('zIndex') + 1);
comboboxWidget = $combox.kmui();
function doProxyDownload(url, filename, type) {
var content = url.split(',')[1]; var content = url.split(',')[1];
var $form = $('<form></form>').attr({ var $form = $('<form></form>').attr({
'action': 'http://172.22.73.36/naotu/download.php', 'action': 'download.php',
'method': 'POST' 'method': 'POST'
}); });
...@@ -59,38 +28,81 @@ KM.registerToolbarUI('saveto', function(name) { ...@@ -59,38 +28,81 @@ KM.registerToolbarUI('saveto', function(name) {
$form.appendTo('body').submit().remove(); $form.appendTo('body').submit().remove();
} }
function doDownload(url, filename, type) { function buildDataUrl(mineType, data) {
if (!kity.Browser.chrome || ~window.location.href.indexOf('naotu.baidu.com')) { return 'data:' + mineType + '; utf-8,' + encodeURIComponent(data);
return doProxyDownload(url, filename, type);
}
var a = document.createElement('a');
a.setAttribute('download', filename);
a.setAttribute('href', url);
a.click();
} }
comboboxWidget.on('comboboxselect', function(evt, res) { function doExport(minder, type) {
var data = me.exportData(res.value); var data = minder.exportData(type);
var p = KityMinder.findProtocal(res.value); var protocal = KityMinder.findProtocal(type);
var filename = me.getMinderTitle() + p.fileExtension; var filename = minder.getMinderTitle() + protocal.fileExtension;
var mineType = protocal.mineType || 'text/plain';
if (typeof(data) == 'string') { if (typeof(data) == 'string') {
var url = 'data:' + (p.mineType || 'text/plain') + '; utf-8,' + encodeURIComponent(data);
doDownload(url, filename, 'text'); doDownload(buildDataUrl(mineType, data), filename, 'text');
} else if (data && data.then) { } else if (data && data.then) {
data.then(function(url) { data.then(function(url) {
doDownload(url, filename, 'base64'); doDownload(url, filename, 'base64');
}); });
} }
}).on('beforeshow', function() { }
if ($combox.parent().length === 0) {
$combox.appendTo(me.$container.find('.kmui-dialog-container')); kity.extendClass(Minder, {
exportFile: function(type) {
doExport(this, type);
return this;
} }
}).on('aftercomboboxselect', function() {
this.setLabelWithDefaultValue();
}); });
KM.registerToolbarUI('saveto', function(name) {
var me = this,
label = me.getLang('tooltips.' + name),
options = {
label: label,
title: label,
comboboxName: name,
items: [],
itemStyles: [],
value: [],
autowidthitem: [],
enabledRecord: false,
enabledSelected: false
},
$combox = null,
comboboxWidget = null;
utils.each(KityMinder.getAllRegisteredProtocals(), function(k) {
var p = KityMinder.findProtocal(k);
if (p.encode) {
var text = p.fileDescription + '(' + p.fileExtension + ')';
options.value.push(k);
options.items.push(text);
options.autowidthitem.push($.wordCountAdaptive(text), true);
}
});
return comboboxWidget.button().addClass('kmui-combobox'); //实例化
$combox = $.kmuibuttoncombobox(options).css('zIndex', me.getOptions('zIndex') + 1);
comboboxWidget = $combox.kmui();
comboboxWidget.on('comboboxselect', function(evt, res) {
doExport(me, res.value);
}).on('beforeshow', function() {
if ($combox.parent().length === 0) {
$combox.appendTo(me.$container.find('.kmui-dialog-container'));
}
}).on('aftercomboboxselect', function() {
this.setLabelWithDefaultValue();
});
return comboboxWidget.button().addClass('kmui-combobox');
});
}); })();
\ No newline at end of file \ No newline at end of file
...@@ -22,7 +22,7 @@ KityMinder.registerModule('DropFile', function() { ...@@ -22,7 +22,7 @@ KityMinder.registerModule('DropFile', function() {
var minder = this; var minder = this;
if (kity.Browser.ie && Number(kity.Browser.version) < 10) { if (kity.Browser.ie && Number(kity.Browser.version) < 10) {
alert('文件导入对IE浏览器仅支持10以上版本'); alert('文件导入对 IE 浏览器仅支持 10 以上版本');
return; return;
} }
...@@ -30,20 +30,27 @@ KityMinder.registerModule('DropFile', function() { ...@@ -30,20 +30,27 @@ KityMinder.registerModule('DropFile', function() {
if (files) { if (files) {
var file = files[0]; var file = files[0];
var ext = file.type || (/(.)\w+$/).exec(file.name)[0]; importMinderFile(minder, file);
console.log(ext); }
}
if ((/xmind/g).test(ext)) { //xmind zip
importSync(minder, file, 'xmind'); function importMinderFile(minder, file) {
} else if ((/mmap/g).test(ext)) { // mindmanager zip if (!file) return;
importSync(minder, file, 'mindmanager');
} else if ((/mm/g).test(ext)) { //freemind xml var ext = /(.)\w+$/.exec(file.name)[0];
importAsync(minder, file, 'freemind');
} else if (/km/.test(ext)) { // txt json if ((/xmind/g).test(ext)) { //xmind zip
importAsync(minder, file, 'json'); importSync(minder, file, 'xmind');
} else if (/txt/.test(ext)) { } else if ((/mmap/g).test(ext)) { // mindmanager zip
importAsync(minder, file, 'plain'); importSync(minder, file, 'mindmanager');
} } else if ((/mm/g).test(ext)) { //freemind xml
importAsync(minder, file, 'freemind');
} else if (/km/.test(ext)) { // txt json
importAsync(minder, file, 'json');
} else if (/txt/.test(ext)) {
importAsync(minder, file, 'plain');
} else {
alert('不支持该文件!');
} }
} }
...@@ -51,7 +58,7 @@ KityMinder.registerModule('DropFile', function() { ...@@ -51,7 +58,7 @@ KityMinder.registerModule('DropFile', function() {
if (!importing) return; if (!importing) return;
createDraft(this); createDraft(this);
social.setRemotePath(null, false); social.setRemotePath(null, false);
this.execCommand('camera', this.getRoot()); this.execCommand('camera', this.getRoot(), 800);
setTimeout(function() { setTimeout(function() {
social.watchChanges(true); social.watchChanges(true);
}, 10); }, 10);
...@@ -80,6 +87,13 @@ KityMinder.registerModule('DropFile', function() { ...@@ -80,6 +87,13 @@ KityMinder.registerModule('DropFile', function() {
draftManager.create(); draftManager.create();
} }
kity.extendClass(Minder, {
importFile: function(file) {
importMinderFile(this, file);
return this;
}
});
return { return {
events: { events: {
'ready': init, 'ready': init,
......
...@@ -12,17 +12,17 @@ html, body, #kityminder, div.kmui-editor-body { ...@@ -12,17 +12,17 @@ html, body, #kityminder, div.kmui-editor-body {
#title, #panel { #title, #panel {
background: #393F4F; background: #393F4F;
font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei'; font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei';
-webkit-font-smoothing: antialiased; /* -webkit-font-smoothing: antialiased; */
} }
#title { #title {
height: 40px; height: 40px;
line-height: 40px; line-height: 45px;
padding: 0; padding: 0;
margin: 0; margin: 0;
padding: 0; padding: 0;
font-size: 14px; font-size: 14px;
color: white; color: #DBDBDB;
text-align: center; text-align: center;
font-weight: 300; font-weight: 300;
font-size: 14px; font-size: 14px;
...@@ -103,7 +103,7 @@ button#tool-btn { ...@@ -103,7 +103,7 @@ button#tool-btn {
display: block; display: block;
position: absolute; position: absolute;
top: 21px; top: 21px;
left: 27px; left: 40px;
width: 0; width: 0;
height: 0; height: 0;
border: solid; border: solid;
...@@ -112,14 +112,14 @@ button#tool-btn { ...@@ -112,14 +112,14 @@ button#tool-btn {
} }
#panel button#tool-btn.active { #panel button#tool-btn.active {
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 -1px 2px rgba(255, 255, 255, .1); /* box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 -1px 2px rgba(255, 255, 255, .1); */
background-color: #677085; /* background-color: #677085; */
border: 1px solid #2E2E2E; /* border: 1px solid #2E2E2E; */
/* padding-top: 10px; */ /* padding-top: 10px; */
/* padding-bottom: 10px; */ /* padding-bottom: 10px; */
height: 28px; /* height: 28px; */
margin-top: -1px; /* margin-top: -1px; */
margin-left: 7px; /* margin-left: 7px; */
position: relative; position: relative;
} }
......
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