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 @@
...
@@ -8,6 +8,7 @@
"white": false,
"white": false,
"quotmark": false,
"quotmark": false,
"browser": true,
"browser": true,
"boss": true,
"predef" : [
"predef" : [
"module",
"module",
"require",
"require",
...
...
lang/zh-cn/zh-cn.js
View file @
69bdc4e6
...
@@ -54,6 +54,8 @@ KityMinder.LANG['zh-cn'] = {
...
@@ -54,6 +54,8 @@ KityMinder.LANG['zh-cn'] = {
'err_create_share'
:
'分享失败'
,
'err_create_share'
:
'分享失败'
,
'err_mkdir'
:
'目录创建失败'
,
'err_mkdir'
:
'目录创建失败'
,
'err_ls'
:
'读取目录失败'
,
'err_ls'
:
'读取目录失败'
,
'err_share_data'
:
'加载分享内容出错'
,
'err_share_sync_fail'
:
'分享内容同步失败'
,
'unknownreason'
:
'可能是外星人篡改了代码...'
,
'unknownreason'
:
'可能是外星人篡改了代码...'
,
'pcs_code'
:
{
'pcs_code'
:
{
...
@@ -126,6 +128,8 @@ KityMinder.LANG['zh-cn'] = {
...
@@ -126,6 +128,8 @@ KityMinder.LANG['zh-cn'] = {
}
}
},
},
'ui'
:
{
'ui'
:
{
'load_share_for_edit'
:
'正在加载分享的文件...'
,
'share_sync_success'
:
'分享内容已同步'
,
'error_detail'
:
'详细信息'
,
'error_detail'
:
'详细信息'
,
'copy_and_feedback'
:
'复制并反馈'
,
'copy_and_feedback'
:
'复制并反馈'
,
...
@@ -157,7 +161,8 @@ KityMinder.LANG['zh-cn'] = {
...
@@ -157,7 +161,8 @@ KityMinder.LANG['zh-cn'] = {
'new'
:
'新建 (Ctrl + Alt + N)'
,
'new'
:
'新建 (Ctrl + Alt + N)'
,
'save'
:
'保存 (Ctrl + S)'
,
'save'
:
'保存 (Ctrl + S)'
,
'share'
:
'分享 (Ctrl + Alt + S)'
,
'share'
:
'分享 (Ctrl + Alt + S)'
,
'feedback'
:
'反馈问题(F1)'
'feedback'
:
'反馈问题(F1)'
,
'editshare'
:
'编辑'
},
},
'menu'
:
{
'menu'
:
{
...
@@ -212,7 +217,7 @@ KityMinder.LANG['zh-cn'] = {
...
@@ -212,7 +217,7 @@ KityMinder.LANG['zh-cn'] = {
'email_share'
:
'邮件邀请'
,
'email_share'
:
'邮件邀请'
,
'url_share'
:
'脑图 URL 地址:'
,
'url_share'
:
'脑图 URL 地址:'
,
'sns_share'
:
'社交网络分享:'
,
'sns_share'
:
'社交网络分享:'
,
'sns_share_text'
:
'“{0}” - 我用
「百度脑图」
制作的思维导图,快看看吧!(地址:{1})'
,
'sns_share_text'
:
'“{0}” - 我用
百度脑图
制作的思维导图,快看看吧!(地址:{1})'
,
'none_share_description'
:
'不分享当前脑图'
,
'none_share_description'
:
'不分享当前脑图'
,
'public_share_description'
:
'创建任何人可见的分享'
,
'public_share_description'
:
'创建任何人可见的分享'
,
'share_button_text'
:
'创建'
,
'share_button_text'
:
'创建'
,
...
...
ui/menu/default.js
View file @
69bdc4e6
...
@@ -17,45 +17,59 @@ KityMinder.registerUI('menu/default', function(minder) {
...
@@ -17,45 +17,59 @@ KityMinder.registerUI('menu/default', function(minder) {
var
$share
=
minder
.
getUI
(
'menu/share/share'
);
var
$share
=
minder
.
getUI
(
'menu/share/share'
);
var
$draft
=
minder
.
getUI
(
'menu/open/draft'
);
var
$draft
=
minder
.
getUI
(
'menu/open/draft'
);
// 主菜单默认选中「打开」
setMenuDefaults
();
$menu
.
$tabs
.
select
(
1
);
loadLandingFile
();
// $menu.show();
// 打开菜单默认选中「本地文件」
// $menu.$tabs.select(5);
$open
.
$tabs
.
select
(
2
);
function
setMenuDefaults
()
{
if
(
$draft
.
hasDraft
())
{
// 草稿箱有草稿,默认选中「草稿箱」,并打开最近编辑的文件
// 主菜单默认选中「打开」
$open
.
$tabs
.
select
(
3
);
$menu
.
$tabs
.
select
(
1
);
$draft
.
openLast
();
}
else
{
// 打开菜单默认选中「本地文件」
// 没有草稿,但用户登陆了
$open
.
$tabs
.
select
(
2
);
// 保存菜单默认选中「导出到本地」
$save
.
$tabs
.
select
(
1
);
// 如果用户登陆了,选中「百度云存储」
fio
.
user
.
check
().
then
(
function
(
user
)
{
fio
.
user
.
check
().
then
(
function
(
user
)
{
if
(
user
)
{
if
(
user
)
{
// 有最近文件选中「最近文件」
$save
.
$tabs
.
select
(
0
);
if
(
$recent
.
hasRecent
())
{
$open
.
$tabs
.
select
(
0
);
$recent
.
loadLast
();
}
// 否则选中网盘目录
else
{
$open
.
$tabs
.
select
(
1
);
}
}
}
});
});
$share
.
$menu
.
$tabs
.
select
(
0
);
// 当前脑图
}
}
// 保存菜单默认选中「导出到本地」
function
loadLandingFile
()
{
$save
.
$tabs
.
select
(
1
);
var
pattern
=
/
(?:
shareId|share_id
)
=
(\w
+
)([
&#
]
|$
)
/
;
var
match
=
pattern
.
exec
(
window
.
location
)
||
pattern
.
exec
(
document
.
referrer
);
// 如果用户登陆了,选中「百度云存储」
if
(
match
)
{
fio
.
user
.
check
().
then
(
function
(
user
)
{
$share
.
loadShareFile
();
if
(
user
)
{
$save
.
$tabs
.
select
(
0
);
}
}
});
else
if
(
$draft
.
hasDraft
())
{
// 草稿箱有草稿,默认选中「草稿箱」,并打开最近编辑的文件
$share
.
$tabs
.
select
(
0
);
// 当前脑图
$open
.
$tabs
.
select
(
3
);
// $menu.show();
$draft
.
openLast
();
// $menu.$tabs.select(5);
}
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) {
...
@@ -41,7 +41,7 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) {
return
open
(
file
.
path
);
return
open
(
file
.
path
);
});
});
function
open
(
path
)
{
function
open
(
path
,
errorHandler
)
{
$menu
.
hide
();
$menu
.
hide
();
...
@@ -74,10 +74,10 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) {
...
@@ -74,10 +74,10 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) {
}
}
function
error
(
e
)
{
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'
);
$
(
minder
.
getRenderTarget
()).
removeClass
(
'loading'
);
...
...
ui/menu/save/download.js
View file @
69bdc4e6
...
@@ -129,7 +129,7 @@ KityMinder.registerUI('menu/save/download', function(minder) {
...
@@ -129,7 +129,7 @@ KityMinder.registerUI('menu/save/download', function(minder) {
netdisk
.
mute
=
true
;
netdisk
.
mute
=
true
;
setTimeout
(
function
()
{
setTimeout
(
function
()
{
netdisk
.
mute
=
false
;
netdisk
.
mute
=
false
;
});
}
,
1000
);
}
}
$form
.
appendTo
(
'body'
).
submit
().
remove
();
$form
.
appendTo
(
'body'
).
submit
().
remove
();
...
...
ui/menu/share/share.js
View file @
69bdc4e6
...
@@ -12,6 +12,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -12,6 +12,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
var
$create_menu
=
$
(
$share_menu
.
createSub
(
'createshare'
));
var
$create_menu
=
$
(
$share_menu
.
createSub
(
'createshare'
));
var
$manage_menu
=
$
(
$share_menu
.
createSub
(
'manageshare'
));
var
$manage_menu
=
$
(
$share_menu
.
createSub
(
'manageshare'
));
var
$doc
=
minder
.
getUI
(
'doc'
);
var
$doc
=
minder
.
getUI
(
'doc'
);
var
notice
=
minder
.
getUI
(
'widget/notice'
);
var
BACKEND_URL
=
'http://naotu.baidu.com/share.php'
;
var
BACKEND_URL
=
'http://naotu.baidu.com/share.php'
;
...
@@ -20,7 +21,11 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -20,7 +21,11 @@ KityMinder.registerUI('menu/share/share', function(minder) {
renderCreatePanel
().
then
(
bindCreatePanelEvent
);
renderCreatePanel
().
then
(
bindCreatePanelEvent
);
renderManagePanel
();
renderManagePanel
();
var
shareListLoaded
=
loadShareList
().
then
(
bindManageActions
);
var
shareListLoaded
=
loadShareList
();
shareListLoaded
.
then
(
renderShareList
);
shareListLoaded
.
then
(
bindManageActions
);
minder
.
on
(
'uiready'
,
function
()
{
minder
.
on
(
'uiready'
,
function
()
{
minder
.
getUI
(
'topbar/user'
).
requireLogin
(
$manage_menu
);
minder
.
getUI
(
'topbar/user'
).
requireLogin
(
$manage_menu
);
...
@@ -52,11 +57,94 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -52,11 +57,94 @@ KityMinder.registerUI('menu/share/share', function(minder) {
id
:
shared
.
id
||
shared
.
shareMinder
.
id
,
id
:
shared
.
id
||
shared
.
shareMinder
.
id
,
record
:
doc
.
json
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
)
{
function
getShareByPath
(
path
)
{
if
(
!
path
||
!
shareList
)
return
null
;
if
(
!
path
||
!
shareList
)
return
null
;
...
@@ -151,9 +239,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -151,9 +239,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
return
;
return
;
case
$target
.
hasClass
(
'edit-action'
):
case
$target
.
hasClass
(
'edit-action'
):
var
$netdisk
=
minder
.
getUI
(
'menu/open/netdisk'
);
loadOriginFile
(
share
);
$netdisk
.
open
(
share
.
path
);
return
;
return
;
}
}
});
});
...
@@ -316,7 +402,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -316,7 +402,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
return
fio
.
user
.
check
().
then
(
function
(
user
)
{
return
fio
.
user
.
check
().
then
(
function
(
user
)
{
if
(
!
user
)
return
;
if
(
!
user
)
return
;
$
.
pajax
(
BACKEND_URL
,
{
return
$
.
pajax
(
BACKEND_URL
,
{
type
:
'GET'
,
type
:
'GET'
,
...
@@ -331,7 +417,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -331,7 +417,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
return
(
shareList
=
result
.
list
||
[]);
return
(
shareList
=
result
.
list
||
[]);
})
.
then
(
renderShareList
)
;
});
});
});
}
}
...
@@ -431,5 +517,8 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -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 @@
...
@@ -51,6 +51,16 @@
}
}
}
}
&.editshare {
margin-right: 5px;
float: right;
&:after {
top: 6.5px;
left: 7px;
background-position: 0 -1060px;
}
}
&:hover {
&:hover {
background-color: @tab-hover;
background-color: @tab-hover;
}
}
...
...
ui/theme/default/css/default.all.css
View file @
69bdc4e6
...
@@ -1973,6 +1973,15 @@ body {
...
@@ -1973,6 +1973,15 @@ body {
left
:
7px
;
left
:
7px
;
background-position
:
0
-970px
;
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
{
#panel
.quick-visit-button
:hover
{
background-color
:
#5a6378
;
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 @@
...
@@ -58,11 +58,11 @@
return
this
.
_ui
[
id
];
return
this
.
_ui
[
id
];
}
}
});
});
$
.
ajaxSetup
({
cache
:
false
});
$
.
extend
(
$
,
{
$
.
extend
(
$
,
{
pajax
:
function
(
opt
)
{
pajax
:
function
()
{
opt
.
cache
=
false
;
return
Promise
.
resolve
(
$
.
ajax
.
apply
(
$
,
arguments
));
return
Promise
.
resolve
(
$
.
ajax
(
opt
));
}
}
});
});
...
...
ui/widget/notice.js
View file @
69bdc4e6
...
@@ -25,6 +25,10 @@ KityMinder.registerUI('widget/notice', function (minder) {
...
@@ -25,6 +25,10 @@ KityMinder.registerUI('widget/notice', function (minder) {
className
:
'error-dialog'
className
:
'error-dialog'
}).
appendTo
(
document
.
getElementById
(
'content-wrapper'
));
}).
appendTo
(
document
.
getElementById
(
'content-wrapper'
));
$error
.
on
(
'ok cancel'
,
function
(
e
)
{
if
(
error
.
resolve
)
error
.
resolve
(
e
);
});
var
$error_body
=
$
(
$error
.
getBodyElement
());
var
$error_body
=
$
(
$error
.
getBodyElement
());
var
isBuilded
=
(
function
()
{
var
isBuilded
=
(
function
()
{
...
@@ -205,6 +209,10 @@ KityMinder.registerUI('widget/notice', function (minder) {
...
@@ -205,6 +209,10 @@ KityMinder.registerUI('widget/notice', function (minder) {
$error
.
show
();
$error
.
show
();
$error
.
getElement
().
style
.
top
=
'180px'
;
$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