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
f0709a44
Commit
f0709a44
authored
Oct 24, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
文件移动及重命名功能
parent
a2cac974
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
640 additions
and
701 deletions
+640
-701
zh-cn.js
lang/zh-cn/zh-cn.js
+5
-0
expand.js
src/module/expand.js
+0
-2
doc.js
ui/doc.js
+35
-16
draft.js
ui/menu/open/draft.js
+1
-0
netdisk.js
ui/menu/open/netdisk.js
+1
-1
recent.js
ui/menu/open/recent.js
+26
-0
netdisk.js
ui/menu/save/netdisk.js
+34
-13
share.js
ui/menu/share/share.js
+55
-4
_kityminder.less
ui/theme/default/css/_kityminder.less
+41
-0
_mainmenu.less
ui/theme/default/css/_mainmenu.less
+1
-1
_netdisk.less
ui/theme/default/css/_netdisk.less
+95
-17
_share.less
ui/theme/default/css/_share.less
+1
-0
finder.svg
ui/theme/default/images/finder.svg
+57
-586
icons.png
ui/theme/default/images/icons.png
+0
-0
title.js
ui/topbar/title.js
+97
-23
locallist.js
ui/widget/locallist.js
+1
-0
netdiskfinder.js
ui/widget/netdiskfinder.js
+190
-38
No files found.
lang/zh-cn/zh-cn.js
View file @
f0709a44
...
@@ -57,6 +57,7 @@ KityMinder.LANG['zh-cn'] = {
...
@@ -57,6 +57,7 @@ KityMinder.LANG['zh-cn'] = {
'err_share_data'
:
'加载分享内容出错'
,
'err_share_data'
:
'加载分享内容出错'
,
'err_share_sync_fail'
:
'分享内容同步失败'
,
'err_share_sync_fail'
:
'分享内容同步失败'
,
'err_move_file'
:
'文件移动失败'
,
'err_move_file'
:
'文件移动失败'
,
'err_rename'
:
'重命名失败'
,
'unknownreason'
:
'可能是外星人篡改了代码...'
,
'unknownreason'
:
'可能是外星人篡改了代码...'
,
'pcs_code'
:
{
'pcs_code'
:
{
...
@@ -131,12 +132,16 @@ KityMinder.LANG['zh-cn'] = {
...
@@ -131,12 +132,16 @@ KityMinder.LANG['zh-cn'] = {
'ui'
:
{
'ui'
:
{
'load_share_for_edit'
:
'正在加载分享的文件...'
,
'load_share_for_edit'
:
'正在加载分享的文件...'
,
'share_sync_success'
:
'分享内容已同步'
,
'share_sync_success'
:
'分享内容已同步'
,
'recycle_clear_confirm'
:
'确认清空回收站么?清空后的文件无法恢复。'
,
'fullscreen_exit_hint'
:
'按 Esc 或 F11 退出全屏'
,
'fullscreen_exit_hint'
:
'按 Esc 或 F11 退出全屏'
,
'error_detail'
:
'详细信息'
,
'error_detail'
:
'详细信息'
,
'copy_and_feedback'
:
'复制并反馈'
,
'copy_and_feedback'
:
'复制并反馈'
,
'move_file_confirm'
:
'确定把 "{0}" 移动到 "{1}" 吗?'
,
'move_file_confirm'
:
'确定把 "{0}" 移动到 "{1}" 吗?'
,
'rename'
:
'重命名'
,
'rename_success'
:
'<b>{0}</b> 重命名成功'
,
'move_success'
:
'<b>{0}</b> 移动成功'
,
'command'
:
{
'command'
:
{
'appendsiblingnode'
:
'插入同级主题'
,
'appendsiblingnode'
:
'插入同级主题'
,
...
...
src/module/expand.js
View file @
f0709a44
...
@@ -73,8 +73,6 @@ KityMinder.registerModule('Expand', function() {
...
@@ -73,8 +73,6 @@ KityMinder.registerModule('Expand', function() {
var
changed
=
node
.
isExpanded
()
?
(
state
==
STATE_COLLAPSE
)
:
(
state
==
STATE_EXPAND
);
var
changed
=
node
.
isExpanded
()
?
(
state
==
STATE_COLLAPSE
)
:
(
state
==
STATE_EXPAND
);
policy
=
policy
||
EXPAND_POLICY
.
KEEP_STATE
;
policy
=
policy
||
EXPAND_POLICY
.
KEEP_STATE
;
policy
(
node
,
state
,
policy
);
policy
(
node
,
state
,
policy
);
if
(
!
changed
)
return
;
node
.
renderTree
().
getMinder
().
layout
(
100
);
node
.
renderTree
().
getMinder
().
layout
(
100
);
...
...
ui/doc.js
View file @
f0709a44
...
@@ -13,6 +13,33 @@ KityMinder.registerUI('doc', function(minder) {
...
@@ -13,6 +13,33 @@ KityMinder.registerUI('doc', function(minder) {
var
current
=
{
saved
:
true
};
var
current
=
{
saved
:
true
};
var
loading
=
false
;
var
loading
=
false
;
var
notice
=
minder
.
getUI
(
'widget/notice'
);
var
notice
=
minder
.
getUI
(
'widget/notice'
);
var
finder
=
minder
.
getUI
(
'widget/netdiskfinder'
);
finder
.
on
(
'mv'
,
trackFileMove
);
function
trackFileMove
(
from
,
to
)
{
if
(
current
.
source
!=
'netdisk'
)
return
;
var
fromPath
=
from
.
split
(
'/'
);
var
toPath
=
to
.
split
(
'/'
);
function
preCommonLength
(
a
,
b
)
{
var
i
=
0
;
while
((
i
in
a
)
&&
(
i
in
b
)
&&
a
[
i
]
==
b
[
i
])
i
++
;
return
(
i
in
b
)
?
0
:
i
;
}
var
originPath
=
current
.
path
.
split
(
'/'
);
var
clen
=
preCommonLength
(
originPath
,
fromPath
);
if
(
clen
)
{
var
movedPath
=
toPath
.
concat
(
originPath
.
slice
(
clen
));
current
.
path
=
movedPath
.
join
(
'/'
);
current
.
title
=
movedPath
.
pop
();
ret
.
fire
(
'docchange'
,
current
);
}
}
/**
/**
* 加载文档
* 加载文档
...
@@ -46,9 +73,8 @@ KityMinder.registerUI('doc', function(minder) {
...
@@ -46,9 +73,8 @@ KityMinder.registerUI('doc', function(minder) {
doc
.
data
=
data
;
doc
.
data
=
data
;
doc
.
json
=
JSON
.
stringify
(
data
);
doc
.
json
=
JSON
.
stringify
(
data
);
minder
.
getUI
(
'topbar/title'
).
setTitle
(
doc
.
title
,
doc
.
saved
);
ret
.
fire
(
'docload'
,
doc
);
ret
.
fire
(
'docload'
,
doc
);
ret
.
fire
(
'docchange'
,
doc
);
return
doc
;
return
doc
;
...
@@ -67,9 +93,10 @@ KityMinder.registerUI('doc', function(minder) {
...
@@ -67,9 +93,10 @@ KityMinder.registerUI('doc', function(minder) {
current
=
doc
;
current
=
doc
;
doc
.
data
=
minder
.
exportJson
();
doc
.
data
=
minder
.
exportJson
();
doc
.
json
=
JSON
.
stringify
(
doc
.
data
);
doc
.
json
=
JSON
.
stringify
(
doc
.
data
);
doc
.
saved
=
true
;
minder
.
getUI
(
'topbar/title'
).
setTitle
(
doc
.
title
,
doc
.
saved
=
true
);
ret
.
fire
(
'docsave'
,
doc
);
ret
.
fire
(
'docsave'
,
doc
);
ret
.
fire
(
'docchange'
,
doc
);
}
}
function
getCurrent
()
{
function
getCurrent
()
{
...
@@ -87,24 +114,16 @@ KityMinder.registerUI('doc', function(minder) {
...
@@ -87,24 +114,16 @@ KityMinder.registerUI('doc', function(minder) {
minder
.
on
(
'contentchange'
,
function
()
{
minder
.
on
(
'contentchange'
,
function
()
{
if
(
loading
)
return
;
if
(
loading
)
return
;
var
$title
=
minder
.
getUI
(
'topbar/title'
);
if
(
current
.
source
!=
'netdisk'
)
{
if
(
current
.
source
!=
'netdisk'
)
{
current
.
title
=
minder
.
getMinderTitle
();
current
.
title
=
minder
.
getMinderTitle
();
$title
.
setTitle
(
current
.
title
,
current
.
saved
=
false
);
current
.
saved
=
false
;
ret
.
fire
(
'docchange'
,
current
);
}
else
{
}
else
{
current
.
saved
=
current
.
json
==
JSON
.
stringify
(
minder
.
exportJson
());
if
(
current
.
json
!=
JSON
.
stringify
(
minder
.
exportJson
()))
{
$title
.
setSaved
(
current
.
saved
=
false
);
ret
.
fire
(
'docchange'
,
current
);
}
else
{
$title
.
setSaved
(
current
.
saved
=
true
);
}
}
}
ret
.
fire
(
'docchange'
,
current
);
});
});
},
1000
);
},
1000
);
...
...
ui/menu/open/draft.js
View file @
f0709a44
...
@@ -96,6 +96,7 @@ KityMinder.registerUI('menu/open/draft', function(minder) {
...
@@ -96,6 +96,7 @@ KityMinder.registerUI('menu/open/draft', function(minder) {
renderList
();
renderList
();
function
pushDraft
(
doc
)
{
function
pushDraft
(
doc
)
{
if
(
doc
.
saved
)
return
;
if
(
doc
==
lastDoc
)
{
if
(
doc
==
lastDoc
)
{
if
(
current
)
{
if
(
current
)
{
draftList
.
remove
(
0
);
draftList
.
remove
(
0
);
...
...
ui/menu/open/netdisk.js
View file @
f0709a44
...
@@ -18,7 +18,7 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) {
...
@@ -18,7 +18,7 @@ KityMinder.registerUI('menu/open/netdisk', function(minder) {
var
notice
=
minder
.
getUI
(
'widget/notice'
);
var
notice
=
minder
.
getUI
(
'widget/notice'
);
/* 网盘面板 */
/* 网盘面板 */
var
$panel
=
$
(
$open
.
createSub
(
'netdisk'
));
var
$panel
=
$
(
$open
.
createSub
(
'netdisk'
))
.
addClass
(
'netdisk-open-panel'
)
;
/* extension => protocol */
/* extension => protocol */
var
supports
=
{};
var
supports
=
{};
...
...
ui/menu/open/recent.js
View file @
f0709a44
...
@@ -15,6 +15,7 @@ KityMinder.registerUI('menu/open/recent', function(minder) {
...
@@ -15,6 +15,7 @@ KityMinder.registerUI('menu/open/recent', function(minder) {
var
frdTime
=
minder
.
getUI
(
'widget/friendlytimespan'
);
var
frdTime
=
minder
.
getUI
(
'widget/friendlytimespan'
);
var
doc
=
minder
.
getUI
(
'doc'
);
var
doc
=
minder
.
getUI
(
'doc'
);
var
recentList
=
minder
.
getUI
(
'widget/locallist'
).
use
(
'recent'
);
var
recentList
=
minder
.
getUI
(
'widget/locallist'
).
use
(
'recent'
);
var
finder
=
minder
.
getUI
(
'widget/netdiskfinder'
);
/* 网盘面板 */
/* 网盘面板 */
var
$panel
=
$
(
$open
.
createSub
(
'recent'
)).
addClass
(
'recent-file-panel'
);
var
$panel
=
$
(
$open
.
createSub
(
'recent'
)).
addClass
(
'recent-file-panel'
);
...
@@ -59,8 +60,33 @@ KityMinder.registerUI('menu/open/recent', function(minder) {
...
@@ -59,8 +60,33 @@ KityMinder.registerUI('menu/open/recent', function(minder) {
doc
.
on
(
'docload'
,
addToList
);
doc
.
on
(
'docload'
,
addToList
);
doc
.
on
(
'docsave'
,
addToList
);
doc
.
on
(
'docsave'
,
addToList
);
finder
.
on
(
'mv'
,
trackFileMove
);
renderList
();
renderList
();
function
trackFileMove
(
from
,
to
)
{
var
fromPath
=
from
.
split
(
'/'
);
var
toPath
=
to
.
split
(
'/'
);
function
preCommonLength
(
a
,
b
)
{
var
i
=
0
;
while
((
i
in
a
)
&&
(
i
in
b
)
&&
a
[
i
]
==
b
[
i
])
i
++
;
return
(
i
in
b
)
?
0
:
i
;
}
recentList
.
forEach
(
function
(
item
)
{
var
originPath
=
item
.
path
.
split
(
'/'
);
var
clen
=
preCommonLength
(
originPath
,
fromPath
);
if
(
clen
)
{
var
movedPath
=
toPath
.
concat
(
originPath
.
slice
(
clen
));
item
.
path
=
movedPath
.
join
(
'/'
);
item
.
filename
=
toPath
.
pop
();
}
});
renderList
();
}
function
addToList
(
doc
)
{
function
addToList
(
doc
)
{
if
(
doc
.
source
!=
'netdisk'
)
return
;
if
(
doc
.
source
!=
'netdisk'
)
return
;
...
...
ui/menu/save/netdisk.js
View file @
f0709a44
...
@@ -66,6 +66,8 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
...
@@ -66,6 +66,8 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
$format
.
val
(
'.km'
);
$format
.
val
(
'.km'
);
$format
.
on
(
'change'
,
normalizeFilename
);
/* 保存按钮 */
/* 保存按钮 */
var
$saveBtn
=
$
(
'<button></button>'
)
var
$saveBtn
=
$
(
'<button></button>'
)
.
addClass
(
'save-button'
)
.
addClass
(
'save-button'
)
...
@@ -73,7 +75,7 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
...
@@ -73,7 +75,7 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
.
click
(
save
)
.
click
(
save
)
.
appendTo
(
$selects
);
.
appendTo
(
$selects
);
$menu
.
on
(
'show'
,
setFile
N
ame
);
$menu
.
on
(
'show'
,
setFile
n
ame
);
$finder
.
on
(
'fileclick'
,
function
(
file
)
{
$finder
.
on
(
'fileclick'
,
function
(
file
)
{
$finder
.
select
(
file
.
path
);
$finder
.
select
(
file
.
path
);
...
@@ -98,7 +100,8 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
...
@@ -98,7 +100,8 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
var
autoSaveTimer
=
0
;
var
autoSaveTimer
=
0
;
function
autoSave
()
{
function
autoSave
()
{
function
lazySave
()
{
function
lazySave
(
doc
)
{
if
(
doc
.
saved
)
return
;
clearTimeout
(
autoSaveTimer
);
clearTimeout
(
autoSaveTimer
);
autoSaveTimer
=
setTimeout
(
saveCurrent
,
autoSaveDuration
);
autoSaveTimer
=
setTimeout
(
saveCurrent
,
autoSaveDuration
);
}
}
...
@@ -127,13 +130,26 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
...
@@ -127,13 +130,26 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
return
doSave
(
doc
.
path
,
doc
.
protocol
,
doc
,
$title
,
'leaveTheMenu'
);
return
doSave
(
doc
.
path
,
doc
.
protocol
,
doc
,
$title
,
'leaveTheMenu'
);
}
}
function
getSaveContext
()
{
function
normalizeFilename
()
{
var
filename
=
$filename
.
val
();
var
filename
=
$filename
.
val
();
var
info
=
fio
.
file
.
anlysisPath
(
filename
);
if
(
fio
.
file
.
anlysisPath
(
filename
).
extension
!=
$format
.
val
())
{
var
ext
=
info
.
extension
;
$filename
.
val
(
filename
+=
$format
.
val
())[
0
].
select
();
if
(
ext
!=
$format
.
val
())
{
if
(
ext
in
supports
)
{
$filename
.
val
(
info
.
name
+
$format
.
val
());
}
else
{
$filename
.
val
(
filename
+
$format
.
val
());
}
$filename
[
0
].
select
();
}
}
return
$filename
.
val
();
}
function
getSaveContext
()
{
var
filename
=
normalizeFilename
();
var
path
=
$finder
.
pwd
()
+
filename
;
var
path
=
$finder
.
pwd
()
+
filename
;
var
doc
=
$doc
.
current
();
var
doc
=
$doc
.
current
();
var
protocol
=
supports
[
$format
.
val
()];
var
protocol
=
supports
[
$format
.
val
()];
...
@@ -212,22 +228,27 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
...
@@ -212,22 +228,27 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
});
});
}
}
function
setFile
N
ame
()
{
function
setFile
n
ame
()
{
var
doc
=
$doc
.
current
();
var
doc
=
$doc
.
current
();
switch
(
doc
.
source
)
{
switch
(
doc
.
source
)
{
case
'netdisk'
:
case
'netdisk'
:
setFile
N
ameForNetDiskSource
(
doc
);
setFile
n
ameForNetDiskSource
(
doc
);
break
;
break
;
default
:
default
:
setFile
N
ameForOtherSource
(
doc
);
setFile
n
ameForOtherSource
(
doc
);
break
;
break
;
}
}
$filename
[
0
].
select
();
$filename
[
0
].
select
();
}
}
function
setFileNameForNetDiskSource
(
doc
)
{
function
setFilenameInputValue
(
filename
)
{
$filename
.
val
(
filename
);
normalizeFilename
(
filename
);
}
function
setFilenameForNetDiskSource
(
doc
)
{
if
(
!
fio
.
user
.
current
())
return
;
if
(
!
fio
.
user
.
current
())
return
;
var
path
=
doc
.
path
;
var
path
=
doc
.
path
;
...
@@ -242,11 +263,11 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
...
@@ -242,11 +263,11 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
$finder
.
select
(
path
);
$finder
.
select
(
path
);
}
}
$filename
.
val
(
pathInfo
.
filename
);
setFilenameInputValue
(
pathInfo
.
filename
);
}
}
function
setFile
N
ameForOtherSource
(
doc
)
{
function
setFile
n
ameForOtherSource
(
doc
)
{
$filename
.
val
(
doc
.
title
);
setFilenameInputValue
(
doc
.
title
);
$finder
.
select
(
null
);
$finder
.
select
(
null
);
}
}
...
...
ui/menu/share/share.js
View file @
f0709a44
...
@@ -11,11 +11,19 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -11,11 +11,19 @@ KityMinder.registerUI('menu/share/share', function(minder) {
var
$share_menu
=
minder
.
getUI
(
'menu/menu'
).
createSubMenu
(
'share'
);
var
$share_menu
=
minder
.
getUI
(
'menu/menu'
).
createSubMenu
(
'share'
);
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
$share_list
=
$
(
'<ul>'
)
.
attr
(
'id'
,
'manage-share-list'
)
.
appendTo
(
$manage_menu
);
var
$doc
=
minder
.
getUI
(
'doc'
);
var
$doc
=
minder
.
getUI
(
'doc'
);
var
notice
=
minder
.
getUI
(
'widget/notice'
);
var
notice
=
minder
.
getUI
(
'widget/notice'
);
var
finder
=
minder
.
getUI
(
'widget/netdiskfinder'
);
var
BACKEND_URL
=
'http://naotu.baidu.com/share.php'
;
var
BACKEND_URL
=
'http://naotu.baidu.com/share.php'
;
if
(
window
.
location
.
host
==
'local.host'
)
{
BACKEND_URL
=
'http://naotu.baidu.com/share_debug.php'
;
// 测试环境
}
var
currentShare
=
null
;
var
currentShare
=
null
;
var
shareList
=
[];
var
shareList
=
[];
...
@@ -67,6 +75,51 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -67,6 +75,51 @@ KityMinder.registerUI('menu/share/share', function(minder) {
}
}
});
});
finder
.
on
(
'mv'
,
trackFileMove
);
function
trackFileMove
(
from
,
to
)
{
var
fromPath
=
from
.
split
(
'/'
);
var
toPath
=
to
.
split
(
'/'
);
function
preCommonLength
(
a
,
b
)
{
var
i
=
0
;
while
((
i
in
a
)
&&
(
i
in
b
)
&&
a
[
i
]
==
b
[
i
])
i
++
;
return
(
i
in
b
)
?
0
:
i
;
}
shareListLoaded
.
then
(
function
(
list
)
{
var
userChecked
=
fio
.
user
.
check
();
list
.
forEach
(
function
(
item
)
{
var
originPath
=
item
.
path
.
split
(
'/'
);
var
clen
=
preCommonLength
(
originPath
,
fromPath
);
if
(
clen
)
{
var
movedPath
=
toPath
.
concat
(
originPath
.
slice
(
clen
));
userChecked
.
then
(
function
(
user
)
{
$
.
pajax
({
url
:
BACKEND_URL
,
type
:
'POST'
,
data
:
{
action
:
'move'
,
ak
:
user
.
access_token
,
id
:
item
.
id
||
item
.
shareMinder
.
id
,
path
:
movedPath
.
join
(
'/'
)
}
}).
then
(
function
()
{
notice
.
info
(
minder
.
getLang
(
'ui.share_sync_success'
,
item
.
title
));
})[
'catch'
](
function
(
e
)
{
notice
.
error
(
'err_share_sync_failed'
,
e
);
});
});
item
.
path
=
movedPath
.
join
(
'/'
);
}
});
renderShareList
(
list
);
});
}
function
loadShareFile
()
{
function
loadShareFile
()
{
var
pattern
=
/
(?:
shareId|share_id
)
=
(\w
+
)([
&#
]
|$
)
/
;
var
pattern
=
/
(?:
shareId|share_id
)
=
(\w
+
)([
&#
]
|$
)
/
;
...
@@ -424,12 +477,10 @@ KityMinder.registerUI('menu/share/share', function(minder) {
...
@@ -424,12 +477,10 @@ KityMinder.registerUI('menu/share/share', function(minder) {
function
renderShareList
(
list
)
{
function
renderShareList
(
list
)
{
var
frdTime
=
minder
.
getUI
(
'widget/friendlytimespan'
);
var
frdTime
=
minder
.
getUI
(
'widget/friendlytimespan'
);
var
$list
=
$
(
'<ul>'
)
.
attr
(
'id'
,
'manage-share-list'
)
.
appendTo
(
$manage_menu
);
if
(
!
list
)
return
;
if
(
!
list
)
return
;
$share_list
.
empty
();
list
.
forEach
(
function
(
share
)
{
list
.
forEach
(
function
(
share
)
{
$list
.
append
(
buildShareItem
(
share
));
$
share_
list
.
append
(
buildShareItem
(
share
));
});
});
}
}
...
...
ui/theme/default/css/_kityminder.less
View file @
f0709a44
...
@@ -71,6 +71,47 @@ html, body {
...
@@ -71,6 +71,47 @@ html, body {
text-align: center;
text-align: center;
font-weight: normal;
font-weight: normal;
color: @ui-fore;
color: @ui-fore;
vertical-align: middle;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
span {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
input {
outline: none;
font-size: 14px;
border: none;
border-radius: 2px;
box-shadow: 0 0 3px black;
padding: 3px 2px 3px 5px;
background: white;
}
&.rename-enabled{
cursor: text;
&:after {
content: ' ';
width: 20px;
height: 20px;
display: inline-block;
background: url(../images/icons.png) 1px -1110px;
vertical-align: middle;
position: relative;
top: -1px;
margin-left: 5px;
opacity: 0;
transition: opacity ease .3s;
}
}
&.rename-enabled:hover:after {
opacity: 0.6;
}
&.loading {
&.loading {
&:before {
&:before {
...
...
ui/theme/default/css/_mainmenu.less
View file @
f0709a44
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
}
}
#main-menu {
#main-menu {
@left-width:
20
0px;
@left-width:
15
0px;
background: white;
background: white;
.dock;
.dock;
...
...
ui/theme/default/css/_netdisk.less
View file @
f0709a44
...
@@ -7,6 +7,13 @@
...
@@ -7,6 +7,13 @@
100% { transform: translate(0, 0); }
100% { transform: translate(0, 0); }
}
}
@keyframes shake-left-right {
0% { transform: translate(0, 0); }
25% { transform: translate(-3px, 0); }
75% { transform: translate(3px, 0); }
100% { transform: translate(0, 0); }
}
.netdisk-finder {
.netdisk-finder {
.dir.drag-enter {
.dir.drag-enter {
...
@@ -23,23 +30,44 @@
...
@@ -23,23 +30,44 @@
}
}
}
}
&.recycle-bin {
.head .control {
.button.mkdir {
display: none;
}
.button.recycle {
display: none;
}
.button.recycle-clear {
display: block;
}
}
.file-list .file-list-item.dir:after {
display: none;
}
}
.head {
.head {
padding-bottom: 10px;
padding-bottom: 10px;
height: 30px;
height: 30px;
border-bottom: 1px solid #eee;
border-bottom: 1px solid #eee;
.control {
.control {
float: right;
float: right;
.mkdir {
}
.button {
.button {
vertical-align: middle;
vertical-align: middle;
font-size: 0;
font-size: 0;
background: url(../images/finder.svg) no-repeat;
background: url(../images/finder.svg) no-repeat;
box-sizing: border-box;
width: 30px;
width: 30px;
height: 30px;
height: 30px;
border-radius: 2px;
border-radius: 2px;
box-sizing: border-box;
border: 1px solid transparent;
border: 1px solid transparent;
&:hover {
border: 1px solid lighten(#717B94, 30%);
}
&:active {
box-shadow: inset 0 1px 3px fadeOut(#717B94, 80%);
}
&.recycle {
&.recycle {
background-position: -30px 0;
background-position: -30px 0;
...
@@ -48,12 +76,11 @@
...
@@ -48,12 +76,11 @@
}
}
}
}
&:hover {
&.recycle-clear {
border: 1px solid lighten(#717B94, 30%);
display: none;
}
background-position: -90px 0;
&:active {
box-shadow: inset 0 1px 3px fadeOut(#717B94, 80%);
}
}
}
}
}
}
.nav {
.nav {
...
@@ -111,6 +138,7 @@
...
@@ -111,6 +138,7 @@
}
}
.file-list {
.file-list {
.dock(41px, 0, 0, 0);
margin: 0;
margin: 0;
padding: 0;
padding: 0;
list-style: none;
list-style: none;
...
@@ -124,20 +152,59 @@
...
@@ -124,20 +152,59 @@
}
}
.file-list-item {
.file-list-item {
font-size: 14px;
font-size: 14px;
height: 20px;
line-height: 20px;
line-height: 20px;
padding: 10px 20px 10px 40px;
padding: 10px 20px 10px 40px;
cursor: default;
cursor: default;
-webkit-user-drag: element;
-webkit-user-drag: element;
-khtml-user-drag: element;
-khtml-user-drag: element;
border: 1px solid transparent;
border: 1px solid transparent;
.rename-button {
display: inline-block;
width: 20px;
height: 20px;
margin-left: 15px;
vertical-align: middle;
border-radius: 2px;
box-sizing: border-box;
border: 1px solid transparent;
opacity: 0;
transition: transform,opacity ease .2s;
transform: scale(0);
font-size: 0;
&:hover {
border: 1px solid lighten(#717B94, 30%);
}
&:active {
box-shadow: inset 0 1px 3px fadeOut(#717B94, 80%);
}
}
.filename {
height: 20px;
line-height: 20px;
vertical-align: middle;
}
input {
margin: 0;
outline: none;
width: 61.80%;
}
&:hover {
&:hover {
/* background-color: lighten(@tab-hover, 55%); */
.rename-button {
}
transition: transform,opacity ease .2s .5s;
&:active {
transform: scale(1);
background-color: lighten(@tab-hover, 50%);
opacity: 1;
background: url(../images/icons.png) 1px -1130px;
}
}
}
&.selected {
&.selected {
&:hover .rename-button {
background: url(../images/icons.png) 1px -1110px;
}
background-color: lighten(@tab-active, 20%);
background-color: lighten(@tab-active, 20%);
color: white;
color: white;
&.dir .icon {
&.dir .icon {
...
@@ -165,6 +232,14 @@
...
@@ -165,6 +232,14 @@
background: url(../images/icons.png) 0 -445px no-repeat;
background: url(../images/icons.png) 0 -445px no-repeat;
}
}
}
}
&.renaming {
input.invalid-name {
animation: shake-left-right .3s ease;
}
.rename-button {
display: none !important;
}
}
&.dir {
&.dir {
position: relative;
position: relative;
.icon {
.icon {
...
@@ -183,16 +258,19 @@
...
@@ -183,16 +258,19 @@
top: 20px;
top: 20px;
margin-top: -4px;
margin-top: -4px;
}
}
input {
margin: 0;
outline: none;
width: 61.80%;
}
}
}
}
}
}
}
}
}
.netdisk-open-panel .netdisk-finder {
.dock;
}
.netdisk-save-panel .netdisk-finder {
.dock(0, 0, 50px, 0);
}
// for save
// for save
.netdisk-save-panel .netdisk-file-list {
.netdisk-save-panel .netdisk-file-list {
bottom: 50px;
bottom: 50px;
...
...
ui/theme/default/css/_share.less
View file @
f0709a44
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
overflow: auto;
overflow: auto;
overflow-x: hidden;
overflow-x: hidden;
overflow-y: auto;
overflow-y: auto;
padding-right: 10px;
&:empty:after {
&:empty:after {
content: '没有分享';
content: '没有分享';
...
...
ui/theme/default/images/finder.svg
View file @
f0709a44
This diff is collapsed.
Click to expand it.
ui/theme/default/images/icons.png
View replaced file @
a2cac974
View file @
f0709a44
20.3 KB
|
W:
|
H:
20.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
ui/topbar/title.js
View file @
f0709a44
...
@@ -9,22 +9,111 @@
...
@@ -9,22 +9,111 @@
KityMinder
.
registerUI
(
'topbar/title'
,
function
(
minder
)
{
KityMinder
.
registerUI
(
'topbar/title'
,
function
(
minder
)
{
var
$title
=
$
(
'<h1>'
).
appendTo
(
'#panel'
);
var
$title
=
$
(
'<h1>'
).
appendTo
(
'#panel'
);
var
$doc
=
minder
.
getUI
(
'doc'
);
var
finder
=
minder
.
getUI
(
'widget/netdiskfinder'
);
var
notice
=
minder
.
getUI
(
'widget/notice'
);
var
renameEnabled
=
false
;
var
renameMode
=
false
;
var
_title
=
minder
.
getLang
(
'ui.untitleddoc'
);
$doc
.
on
(
'docchange'
,
update
);
var
_saved
=
false
;
$title
.
on
(
'click'
,
rename
);
function
rename
()
{
if
(
!
renameEnabled
||
renameMode
)
return
;
var
doc
=
$doc
.
current
();
var
$input
=
$
(
'<input>'
).
width
(
$title
.
find
(
'.title-content'
).
width
());
var
oldFilename
=
doc
.
title
;
var
oldPath
=
doc
.
path
;
$input
.
val
(
oldFilename
);
setTimeout
(
function
()
{
$input
[
0
].
select
();
});
$title
.
addClass
(
'rename-mode'
);
$title
.
empty
();
$title
.
append
(
$input
);
renameMode
=
true
;
$input
.
on
(
'keydown'
,
function
(
e
)
{
if
(
e
.
keyCode
==
13
)
confirm
();
else
if
(
e
.
keyCode
==
27
)
{
cancel
();
e
.
stopPropagation
();
}
}).
on
(
'blur'
,
cancel
);
function
exit
()
{
setTimeout
(
function
()
{
renameMode
=
false
;
});
}
function
cancel
()
{
update
();
exit
();
}
function
confirm
()
{
var
newFilename
=
$input
.
val
();
var
oldFilenameInfo
=
fio
.
file
.
anlysisPath
(
oldFilename
);
var
newFilenameInfo
=
fio
.
file
.
anlysisPath
(
newFilename
);
if
(
!
newFilenameInfo
.
name
.
length
)
return
cancel
();
newFilename
=
newFilenameInfo
.
name
+
oldFilenameInfo
.
extension
;
var
newPath
=
fio
.
file
.
anlysisPath
(
oldPath
).
parentPath
+
newFilename
;
if
(
newPath
==
oldPath
)
return
cancel
();
$title
.
addClass
(
'loading'
);
fio
.
file
.
move
({
path
:
oldPath
,
newPath
:
newPath
}).
then
(
function
()
{
doc
.
path
=
newPath
;
doc
.
title
=
newFilename
;
finder
.
fire
(
'mv'
,
oldPath
,
newPath
);
notice
.
info
(
minder
.
getLang
(
'ui.rename_success'
,
newFilename
));
})[
'catch'
](
function
(
e
)
{
notice
.
error
(
'err_rename'
,
e
);
}).
then
(
function
()
{
$title
.
removeClass
(
'loading'
);
update
();
exit
();
});
}
}
function
enableRename
(
enabled
)
{
renameEnabled
=
enabled
;
if
(
enabled
)
$title
.
addClass
(
'rename-enabled'
);
else
$title
.
removeClass
(
'rename-enabled'
);
}
function
update
()
{
function
update
()
{
var
doc
=
$doc
.
current
();
function
setTitle
(
title
)
{
function
setTitle
(
title
)
{
$title
.
text
(
title
);
title
=
title
||
minder
.
getLang
(
'ui.untitleddoc'
);
document
.
title
=
title
+
' - 百度脑图'
;
$title
.
empty
().
append
(
'<span class="title-content">'
+
title
+
'</span>'
);
document
.
title
=
title
?
title
+
' - 百度脑图'
:
'百度脑图'
;
}
}
if
(
_
saved
)
{
if
(
doc
.
saved
)
{
setTitle
(
_
title
);
setTitle
(
doc
.
title
);
}
else
{
}
else
{
setTitle
(
'* '
+
_
title
);
setTitle
(
'* '
+
doc
.
title
);
}
}
enableRename
(
doc
.
source
==
'netdisk'
&&
doc
.
saved
);
}
}
update
();
update
();
...
@@ -32,23 +121,8 @@ KityMinder.registerUI('topbar/title', function(minder) {
...
@@ -32,23 +121,8 @@ KityMinder.registerUI('topbar/title', function(minder) {
return
{
return
{
$title
:
$title
,
$title
:
$title
,
setTitle
:
function
(
title
,
saved
)
{
_title
=
title
;
return
this
.
setSaved
(
saved
);
},
getTitle
:
function
()
{
getTitle
:
function
()
{
return
_title
;
return
$doc
.
current
().
title
;
},
setSaved
:
function
(
saved
)
{
_saved
=
saved
!==
false
;
update
();
return
this
;
}
}
};
};
});
});
\ No newline at end of file
ui/widget/locallist.js
View file @
f0709a44
...
@@ -70,6 +70,7 @@ KityMinder.registerUI('widget/locallist', function() {
...
@@ -70,6 +70,7 @@ KityMinder.registerUI('widget/locallist', function() {
function
forEach
(
callback
)
{
function
forEach
(
callback
)
{
list
.
forEach
(
callback
);
list
.
forEach
(
callback
);
save
();
}
}
load
.
call
(
this
);
load
.
call
(
this
);
...
...
ui/widget/netdiskfinder.js
View file @
f0709a44
This diff is collapsed.
Click to expand it.
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