Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
69bdc4e6
Commit
69bdc4e6
authored
Oct 14, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
share-edit
parent
64b250b0
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
186 additions
and
50 deletions
+186
-50
.jshintrc
.jshintrc
+1
-0
zh-cn.js
lang/zh-cn/zh-cn.js
+7
-2
default.js
ui/menu/default.js
+46
-32
netdisk.js
ui/menu/open/netdisk.js
+3
-3
download.js
ui/menu/save/download.js
+1
-1
share.js
ui/menu/share/share.js
+96
-7
_quickvisit.less
ui/theme/default/css/_quickvisit.less
+10
-0
default.all.css
ui/theme/default/css/default.all.css
+9
-0
default.all.css.map
ui/theme/default/css/default.all.css.map
+1
-1
icons.png
ui/theme/default/images/icons.png
+0
-0
ui.js
ui/ui.js
+4
-4
notice.js
ui/widget/notice.js
+8
-0
No files found.
.jshintrc
View file @
69bdc4e6
...
...
@@ -8,6 +8,7 @@
"white": false,
"quotmark": false,
"browser": true,
"boss": true,
"predef" : [
"module",
"require",
...
...
lang/zh-cn/zh-cn.js
View file @
69bdc4e6
...
...
@@ -54,6 +54,8 @@ KityMinder.LANG['zh-cn'] = {
'err_create_share'
:
'分享失败'
,
'err_mkdir'
:
'目录创建失败'
,
'err_ls'
:
'读取目录失败'
,
'err_share_data'
:
'加载分享内容出错'
,
'err_share_sync_fail'
:
'分享内容同步失败'
,
'unknownreason'
:
'可能是外星人篡改了代码...'
,
'pcs_code'
:
{
...
...
@@ -126,6 +128,8 @@ KityMinder.LANG['zh-cn'] = {
}
},
'ui'
:
{
'load_share_for_edit'
:
'正在加载分享的文件...'
,
'share_sync_success'
:
'分享内容已同步'
,
'error_detail'
:
'详细信息'
,
'copy_and_feedback'
:
'复制并反馈'
,
...
...
@@ -157,7 +161,8 @@ KityMinder.LANG['zh-cn'] = {
'new'
:
'新建 (Ctrl + Alt + N)'
,
'save'
:
'保存 (Ctrl + S)'
,
'share'
:
'分享 (Ctrl + Alt + S)'
,
'feedback'
:
'反馈问题(F1)'
'feedback'
:
'反馈问题(F1)'
,
'editshare'
:
'编辑'
},
'menu'
:
{
...
...
@@ -212,7 +217,7 @@ KityMinder.LANG['zh-cn'] = {
'email_share'
:
'邮件邀请'
,
'url_share'
:
'脑图 URL 地址:'
,
'sns_share'
:
'社交网络分享:'
,
'sns_share_text'
:
'“{0}” - 我用
「百度脑图」
制作的思维导图,快看看吧!(地址:{1})'
,
'sns_share_text'
:
'“{0}” - 我用
百度脑图
制作的思维导图,快看看吧!(地址:{1})'
,
'none_share_description'
:
'不分享当前脑图'
,
'public_share_description'
:
'创建任何人可见的分享'
,
'share_button_text'
:
'创建'
,
...
...
ui/menu/default.js
View file @
69bdc4e6
...
...
@@ -17,45 +17,59 @@ KityMinder.registerUI('menu/default', function(minder) {
var
$share
=
minder
.
getUI
(
'menu/share/share'
);
var
$draft
=
minder
.
getUI
(
'menu/open/draft'
);
// 主菜单默认选中「打开」
$menu
.
$tabs
.
select
(
1
);
// 打开菜单默认选中「本地文件」
$open
.
$tabs
.
select
(
2
);
if
(
$draft
.
hasDraft
())
{
// 草稿箱有草稿,默认选中「草稿箱」,并打开最近编辑的文件
$open
.
$tabs
.
select
(
3
);
$draft
.
openLast
();
}
else
{
// 没有草稿,但用户登陆了
setMenuDefaults
();
loadLandingFile
();
// $menu.show();
// $menu.$tabs.select(5);
function
setMenuDefaults
()
{
// 主菜单默认选中「打开」
$menu
.
$tabs
.
select
(
1
);
// 打开菜单默认选中「本地文件」
$open
.
$tabs
.
select
(
2
);
// 保存菜单默认选中「导出到本地」
$save
.
$tabs
.
select
(
1
);
// 如果用户登陆了,选中「百度云存储」
fio
.
user
.
check
().
then
(
function
(
user
)
{
if
(
user
)
{
// 有最近文件选中「最近文件」
if
(
$recent
.
hasRecent
())
{
$open
.
$tabs
.
select
(
0
);
$recent
.
loadLast
();
}
// 否则选中网盘目录
else
{
$open
.
$tabs
.
select
(
1
);
}
$save
.
$tabs
.
select
(
0
);
}
});
$share
.
$menu
.
$tabs
.
select
(
0
);
// 当前脑图
}
// 保存菜单默认选中「导出到本地」
$save
.
$tabs
.
select
(
1
);
function
loadLandingFile
()
{
var
pattern
=
/
(?:
shareId|share_id
)
=
(\w
+
)([
&#
]
|$
)
/
;
var
match
=
pattern
.
exec
(
window
.
location
)
||
pattern
.
exec
(
document
.
referrer
);
// 如果用户登陆了,选中「百度云存储」
fio
.
user
.
check
().
then
(
function
(
user
)
{
if
(
user
)
{
$save
.
$tabs
.
select
(
0
);
if
(
match
)
{
$share
.
loadShareFile
();
}
});
$share
.
$tabs
.
select
(
0
);
// 当前脑图
// $menu.show();
// $menu.$tabs.select(5);
else
if
(
$draft
.
hasDraft
())
{
// 草稿箱有草稿,默认选中「草稿箱」,并打开最近编辑的文件
$open
.
$tabs
.
select
(
3
);
$draft
.
openLast
();
}
else
{
// 没有草稿,但用户登陆了
fio
.
user
.
check
().
then
(
function
(
user
)
{
if
(
user
)
{
// 有最近文件选中「最近文件」
if
(
$recent
.
hasRecent
())
{
$open
.
$tabs
.
select
(
0
);
$recent
.
loadLast
();
}
// 否则选中网盘目录
else
{
$open
.
$tabs
.
select
(
1
);
}
}
});
}
}
});
});
\ No newline at end of file
ui/menu/open/netdisk.js
View file @
69bdc4e6
...
...
@@ -41,7 +41,7 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) {
return
open
(
file
.
path
);
});
function
open
(
path
)
{
function
open
(
path
,
errorHandler
)
{
$menu
.
hide
();
...
...
@@ -74,10 +74,10 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) {
}
function
error
(
e
)
{
return
notice
.
error
(
'err_load'
,
e
);
return
errorHandler
&&
errorHandler
(
e
)
||
notice
.
error
(
'err_load'
,
e
);
}
return
read
().
then
(
load
,
error
).
then
(
function
()
{
return
read
().
then
(
load
)[
'catch'
](
error
).
then
(
function
()
{
$
(
minder
.
getRenderTarget
()).
removeClass
(
'loading'
);
...
...
ui/menu/save/download.js
View file @
69bdc4e6
...
...
@@ -129,7 +129,7 @@ KityMinder.registerUI('menu/save/download', function(minder) {
netdisk
.
mute
=
true
;
setTimeout
(
function
()
{
netdisk
.
mute
=
false
;
});
}
,
1000
);
}
$form
.
appendTo
(
'body'
).
submit
().
remove
();
...
...
ui/menu/share/share.js
View file @
69bdc4e6
...
...
@@ -12,6 +12,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
var
$create_menu
=
$
(
$share_menu
.
createSub
(
'createshare'
));
var
$manage_menu
=
$
(
$share_menu
.
createSub
(
'manageshare'
));
var
$doc
=
minder
.
getUI
(
'doc'
);
var
notice
=
minder
.
getUI
(
'widget/notice'
);
var
BACKEND_URL
=
'http://naotu.baidu.com/share.php'
;
...
...
@@ -20,7 +21,11 @@ KityMinder.registerUI('menu/share/share', function(minder) {
renderCreatePanel
().
then
(
bindCreatePanelEvent
);
renderManagePanel
();
var
shareListLoaded
=
loadShareList
().
then
(
bindManageActions
);
var
shareListLoaded
=
loadShareList
();
shareListLoaded
.
then
(
renderShareList
);
shareListLoaded
.
then
(
bindManageActions
);
minder
.
on
(
'uiready'
,
function
()
{
minder
.
getUI
(
'topbar/user'
).
requireLogin
(
$manage_menu
);
...
...
@@ -52,11 +57,94 @@ KityMinder.registerUI('menu/share/share', function(minder) {
id
:
shared
.
id
||
shared
.
shareMinder
.
id
,
record
:
doc
.
json
}
}).
then
(
function
()
{
notice
.
info
(
minder
.
getLang
(
'ui.share_sync_success'
,
doc
.
title
));
})[
'catch'
](
function
(
e
)
{
notice
.
error
(
'err_share_sync_failed'
,
e
);
});
});
}
});
function
loadShareFile
()
{
var
pattern
=
/
(?:
shareId|share_id
)
=
(\w
+
)([
&#
]
|$
)
/
;
var
match
=
pattern
.
exec
(
window
.
location
)
||
pattern
.
exec
(
document
.
referrer
);
if
(
!
match
)
return
Promise
.
resolve
(
null
);
var
shareId
=
match
[
1
];
$
(
minder
.
getRenderTarget
()).
addClass
(
'loading'
);
shareListLoaded
.
then
(
function
(
list
)
{
for
(
var
i
=
0
;
i
<
list
.
length
;
i
++
)
{
var
id
=
list
[
i
].
id
||
list
[
i
].
shareMinder
.
id
;
if
(
id
==
shareId
&&
list
[
i
].
path
)
{
return
loadOriginFile
(
list
[
i
]);
}
}
return
loadShare
(
shareId
);
});
}
function
loadOriginFile
(
share
)
{
var
$netdisk
=
minder
.
getUI
(
'menu/open/netdisk'
);
notice
.
info
(
minder
.
getLang
(
'ui.load_share_for_edit'
,
share
.
title
));
return
$netdisk
.
open
(
share
.
path
,
function
()
{
// 网盘加载失败
return
loadShare
(
share
);
});
}
function
loadShare
(
shareId
)
{
function
renderShareData
(
data
)
{
if
(
data
.
error
)
{
notice
.
error
(
'err_share_data'
,
data
.
error
);
return
;
}
var
content
=
data
.
shareMinder
.
data
;
return
$doc
.
load
({
source
:
'share'
,
content
:
content
,
protocol
:
'json'
,
saved
:
true
,
ownerId
:
data
.
uid
,
ownerName
:
data
.
uname
});
}
var
$container
=
$
(
minder
.
getRenderTarget
()).
addClass
(
'loading'
);
return
$
.
pajax
({
url
:
'http://naotu.baidu.com/share.php'
,
data
:
{
action
:
'find'
,
id
:
shareId
},
dataType
:
'json'
}).
then
(
renderShareData
)[
'catch'
](
function
(
e
)
{
notice
.
error
(
'err_share_data'
,
e
);
}).
then
(
function
()
{
$container
.
removeClass
(
'loading'
);
});
}
function
getShareByPath
(
path
)
{
if
(
!
path
||
!
shareList
)
return
null
;
...
...
@@ -151,9 +239,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
return
;
case
$target
.
hasClass
(
'edit-action'
):
var
$netdisk
=
minder
.
getUI
(
'menu/open/netdisk'
);
$netdisk
.
open
(
share
.
path
);
loadOriginFile
(
share
);
return
;
}
});
...
...
@@ -316,7 +402,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
return
fio
.
user
.
check
().
then
(
function
(
user
)
{
if
(
!
user
)
return
;
$
.
pajax
(
BACKEND_URL
,
{
return
$
.
pajax
(
BACKEND_URL
,
{
type
:
'GET'
,
...
...
@@ -331,7 +417,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
return
(
shareList
=
result
.
list
||
[]);
})
.
then
(
renderShareList
)
;
});
});
}
...
...
@@ -431,5 +517,8 @@ KityMinder.registerUI('menu/share/share', function(minder) {
}
}
return
$share_menu
;
return
{
$menu
:
$share_menu
,
loadShareFile
:
loadShareFile
};
});
\ No newline at end of file
ui/theme/default/css/_quickvisit.less
View file @
69bdc4e6
...
...
@@ -51,6 +51,16 @@
}
}
&.editshare {
margin-right: 5px;
float: right;
&:after {
top: 6.5px;
left: 7px;
background-position: 0 -1060px;
}
}
&:hover {
background-color: @tab-hover;
}
...
...
ui/theme/default/css/default.all.css
View file @
69bdc4e6
...
...
@@ -1973,6 +1973,15 @@ body {
left
:
7px
;
background-position
:
0
-970px
;
}
#panel
.quick-visit-button.editshare
{
margin-right
:
5px
;
float
:
right
;
}
#panel
.quick-visit-button.editshare
:after
{
top
:
6.5px
;
left
:
7px
;
background-position
:
0
-1060px
;
}
#panel
.quick-visit-button
:hover
{
background-color
:
#5a6378
;
}
...
...
ui/theme/default/css/default.all.css.map
View file @
69bdc4e6
This diff is collapsed.
Click to expand it.
ui/theme/default/images/icons.png
View replaced file @
64b250b0
View file @
69bdc4e6
19.2 KB
|
W:
|
H:
19.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/ui.js
View file @
69bdc4e6
...
...
@@ -58,11 +58,11 @@
return
this
.
_ui
[
id
];
}
});
$
.
ajaxSetup
({
cache
:
false
});
$
.
extend
(
$
,
{
pajax
:
function
(
opt
)
{
opt
.
cache
=
false
;
return
Promise
.
resolve
(
$
.
ajax
(
opt
));
pajax
:
function
()
{
return
Promise
.
resolve
(
$
.
ajax
.
apply
(
$
,
arguments
));
}
});
...
...
ui/widget/notice.js
View file @
69bdc4e6
...
...
@@ -25,6 +25,10 @@ KityMinder.registerUI('widget/notice', function (minder) {
className
:
'error-dialog'
}).
appendTo
(
document
.
getElementById
(
'content-wrapper'
));
$error
.
on
(
'ok cancel'
,
function
(
e
)
{
if
(
error
.
resolve
)
error
.
resolve
(
e
);
});
var
$error_body
=
$
(
$error
.
getBodyElement
());
var
isBuilded
=
(
function
()
{
...
...
@@ -205,6 +209,10 @@ KityMinder.registerUI('widget/notice', function (minder) {
$error
.
show
();
$error
.
getElement
().
style
.
top
=
'180px'
;
return
new
Promise
(
function
(
resolve
)
{
error
.
resolve
=
resolve
;
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment