Commit 896c10aa authored by techird's avatar techird

merge from dev

parents 8dd3d5e8 7aa1c985
# KityMinder Change Log
# KityMinder 更新日志
## v1.1.1
......@@ -8,11 +8,13 @@
* 新建脑图(`Ctrl` + `N`
* 保存脑图到云端(`Ctrl` + `S`
* 分享脑图(`Ctrl` + `Shift` + `S`
2. 草稿功能升级为草稿箱
3. 添加了帮助菜单
### 问题修复
1. 修复切换文件时,回复历史没有清空的问题
2. 修复在添加 markers 时,会出现 js 报错的问题
## v1.1.0
......
......@@ -15,19 +15,22 @@ KM是基于SVG技术实现,使用JavaScript+html实现。支持绝大多数的
4. IE9+
## 线上版本
[http://naotu.baidu.com](http://naotu.baidu.com)
注意:由于历史原因,有两个发布过的公开地址:
产品地址:[http://naotu.baidu.com](http://naotu.baidu.com)
注意:由于历史原因,有三个发布过的公开地址:
1. [~~http://fex-team.baidu.com/kityminder/dist~~](http://fex-team.baidu.com/kityminder/dist)
2. [~~http://kitygraph.github.io/kityminder/dist~~](http://kitygraph.github.io/kityminder/dist)
3. [http://fex.baidu.com/kityminder/dist](http://fex.baidu.com/kityminder/dist)
第 1 个地址已经失效;
第 2 个地址不再维护更新,不便之处;
第 3 个地址会是最新发布的版本;
新地址已经稳定,请大家放心使用。地址变动频繁带来的不便,请谅解。
第 2 个地址不再维护更新(原因是我们项目地址迁移到了 fex-team);
第 3 个地址是更新频率最高的地址,新功能可以在这里尝鲜;
[产品地址](http://naotu.baidu.com)已经稳定,请大家放心使用。地址变动频繁带来的不便,请谅解。
## 依赖说明
......
......@@ -22,6 +22,21 @@
<body>
<div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" >
<h3>URL分享:</h3>
<p>
<input id="share-url" type="url" value="" />
</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
......
......@@ -24,6 +24,21 @@
<body>
<div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" >
<h3>URL分享:</h3>
<p>
<input id="share-url" type="url" value="" />
</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>
<p id="about">
KityMinder <a id="km-version" href="https://github.com/fex-team/kityminder/blob/dev/CHANGELOG.md" target="blank"></a>, Powered by f-cube, <a href="http://fex.baidu.com" target="_blank">FEX</a> |
<a href="https://github.com/fex-team/kityminder.git" target="_blank">Source</a> |
......
......@@ -19,3 +19,8 @@ button.user-file{position:relative;padding-right:28px}button.user-file:after{con
.draft-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-item-label{display:block;margin-left:28px}
.draft-menu.kmui-combobox-menu .kmui-combobox-checked:hover{color:#ccc}.draft-menu.kmui-combobox-menu .kmui-combobox-checked:hover .kmui-combobox-icon{background-position:center 0}
.user-file-menu{margin-top:20px;margin-left:1px}
#share-dialog{position:absolute;padding:20px;border-radius:4px;right:10px;top:65px;background:#fff;width:300px;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:98%}
#share-dialog p,#share-dialog #share-platform{margin:20px 0 30px}
#share-dialog #share-platform{margin-bottom:0}
#share-dialog:before{position:absolute;content:' ';width:0;height:0;line-height:0;display:block;border:10px solid transparent;border-bottom-color:#fff;right:30px;top:-20px}
/* global Promise: true */
/**
* 百度脑图社会化功能
*
* 1. 百度账号登陆
* 2. 百度云存储
* 3. 分享
* 4. 草稿箱
* @author techird
*/
$.extend( $.fn, {
disabled: function ( value ) {
if ( value === undefined ) return !!this.attr( 'disabled' );
......@@ -42,7 +49,8 @@ $.extend( $.fn, {
$( function () {
// UI 元素
var $panel, $login_btn, $save_btn, $share_btn, $user_btn, $user_menu, $draft_btn, $draft_menu,
var $panel, $login_btn, $save_btn, $share_btn, $user_btn, $user_menu,
$draft_btn, $draft_menu, $share_dialog, $share_url,
// 当前文件的远端路径
remotePath = null,
......@@ -57,26 +65,20 @@ $( function () {
return ( ( +new Date() * 10000 ) + ( Math.random() * 9999 ) ).toString( 36 );
},
// 当前脑图的分享连接
// 当前脑图的分享ID
shareId = uuid(),
// 查找 baseUrl
baseUrl = ( function () {
var scripts = document.getElementsByTagName( 'script' );
for ( var i = 0; i < scripts.length; i++ ) {
var index = scripts[ i ].src.indexOf( 'social.js' );
if ( ~index ) {
return scripts[ i ].src.substr( 0, index );
}
}
} )(),
titleSuffix = document.title || '百度脑图',
notice = window.alert,
// 脑图实例
minder = window.km,
// 草稿箱
draftManager = new window.DraftManager( minder ),
// 当前是否要检测文档内容是否变化的开关
watchingChanges = true;
start();
......@@ -128,6 +130,19 @@ $( function () {
$draft_menu = $.kmuidropmenu().addClass( 'draft-menu kmui-combobox-menu' ).appendTo( 'body' );
$draft_menu.kmui().attachTo( $draft_btn );
$draft_menu.on( 'aftershow', showDraftList );
$share_dialog = $( '#share-dialog' );
$share_url = $( '#share-url' );
$share_dialog.mousedown( function ( e ) {
e.stopPropagation();
} );
$( 'body' ).on( 'mousedown', function ( e ) {
$share_dialog.hide();
$share_btn.loading( false );
} );
}
// 初始化云平台 frontia
......@@ -192,6 +207,9 @@ $( function () {
} else if ( currentAccount ) {
$user_btn.text( '* ' + minder.getMinderTitle() );
}
document.title = [ filename || minder.getMinderTitle(), titleSuffix ].join( ' - ' );
if ( saved ) {
$save_btn.disabled( true ).text( '已保存' );
} else {
......@@ -394,9 +412,9 @@ $( function () {
return;
}
var currentUrl = window.location.origin + window.location.pathname,
var baseUrl = /^(.*?)(\?|\#|$)/.exec( window.location.href )[ 1 ];
shareUrl = currentUrl + '?shareId=' + shareId,
var shareUrl = baseUrl + '?shareId=' + shareId,
shareData = new baidu.frontia.Data( {
shareMinder: {
......@@ -405,41 +423,21 @@ $( function () {
}
} );
var shareConfig = window._bd_share_config.common,
resetShare = window._bd_share_main.init;
$share_btn.loading( '正在分享...' );
baidu.frontia.storage.insertData( shareData, {
success: function () {
var $popup, $url;
$popup = $( '<div></div>' ).addClass( 'popup' ).appendTo( 'body' );
$popup.css( {
'position': 'absolute',
'right': 10,
'top': $share_btn.offset().top + $share_btn.height() + 10,
'width': 250,
'padding': 10,
'background': 'white',
'border-radius': '5px',
'box-shadow': '1px 2px 4px rgba(0, 0, 0, .3)'
} );
$popup.append( '<p style="margin: 5px 0; font-size: 12px;">分享成功,请复制URL:</p>' );
$url = $( '<input type="text" style="width: 250px;" value="' + shareUrl + '"></input>' ).appendTo( $popup );
$url[ 0 ].select();
$popup.mousedown( function ( e ) {
e.stopPropagation();
} );
$( 'body' ).one( 'mousedown', function ( e ) {
$popup.fadeOut( 'fast', function () {
$popup.remove();
} );
$share_btn.loading( false );
} );
$share_dialog.show();
$share_url.val( shareUrl )[ 0 ].select();
}
} );
shareConfig.bdTitle = shareConfig.bdText = minder.getMinderTitle();
shareConfig.bdDesc = shareConfig.bdText = '“' + minder.getMinderTitle() + '” - 我用百度脑图制作的思维导图,快看看吧!(地址:' + shareUrl + ')';
shareConfig.bdUrl = shareUrl;
resetShare();
}
function bindShortCuts() {
......
......@@ -190,4 +190,47 @@ button {
.user-file-menu {
margin-top: 20px;
margin-left: 1px;
}
#share-dialog {
position: absolute;
padding: 20px;
border-radius: 4px;
right: 10px;
top: 65px;
background: white;
width: 300px;
box-shadow: 1px 2px 16px rgba(0, 0, 0, .5);
display: none;
h3 {
margin: 0;
font-size: 16px;
color: #666;
}
input {
width: 98%;
}
p, #share-platform {
margin: 20px 0 30px;
}
#share-platform {
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
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