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
d6ac76bc
Commit
d6ac76bc
authored
Mar 25, 2014
by
campaign
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
https://github.com/fex-team/kityminder
into dev
parents
7053dcf0
8057635b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
28 deletions
+67
-28
draftmanager.js
social/draftmanager.js
+13
-1
social.js
social/social.js
+53
-27
Manual regression cases.xmind
spec/testdesign/Manual regression cases.xmind
+0
-0
view.js
src/module/view.js
+1
-0
No files found.
social/draftmanager.js
View file @
d6ac76bc
...
...
@@ -62,6 +62,10 @@ function DraftManager( minder ) {
return
current
;
}
function
getCurrent
()
{
return
current
;
}
function
openByPath
(
path
)
{
for
(
var
i
=
0
;
i
<
drafts
.
length
;
i
++
)
{
if
(
drafts
[
i
].
path
==
path
)
return
open
(
i
);
...
...
@@ -76,11 +80,17 @@ function DraftManager( minder ) {
current
.
path
=
path
||
current
.
path
;
current
.
name
=
minder
.
getMinderTitle
();
current
.
data
=
minder
.
exportData
(
"json"
);
current
.
sync
=
false
;
current
.
update
=
new
Date
();
store
();
}
}
function
sync
()
{
current
.
sync
=
true
;
store
();
}
function
list
()
{
return
drafts
.
slice
();
}
...
...
@@ -103,6 +113,8 @@ function DraftManager( minder ) {
create
:
create
,
list
:
list
,
remove
:
remove
,
clear
:
clear
clear
:
clear
,
getCurrent
:
getCurrent
,
sync
:
sync
};
}
\ No newline at end of file
social/social.js
View file @
d6ac76bc
...
...
@@ -191,6 +191,11 @@ $( function () {
}
else
if
(
currentAccount
)
{
$user_btn
.
text
(
'* '
+
minder
.
getMinderTitle
()
);
}
if
(
saved
)
{
$save_btn
.
disabled
(
true
).
text
(
'已保存'
);
}
else
{
$save_btn
.
disabled
(
false
).
text
(
'保存'
);
}
}
// 检查是否在 Cookie 中登录过了
...
...
@@ -270,7 +275,6 @@ $( function () {
url
:
url
,
dataType
:
'text'
,
success
:
function
(
result
)
{
watchingChanges
=
false
;
minder
.
importData
(
result
,
'json'
);
...
...
@@ -279,11 +283,11 @@ $( function () {
draftManager
.
create
();
}
draftManager
.
save
(
remotePath
);
watchingChanges
=
true
;
draftManager
.
sync
();
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
);
$user_btn
.
loading
(
false
).
text
(
getFileName
(
remotePath
)
);
watchingChanges
=
true
;
}
}
);
},
...
...
@@ -313,8 +317,22 @@ $( function () {
// 点击文件菜单
function
openFile
(
e
)
{
setRemotePath
(
$
(
this
).
data
(
'value'
),
true
);
loadRemote
();
var
path
=
$
(
this
).
data
(
'value'
);
var
draft
=
draftManager
.
getCurrent
();
if
(
draft
.
path
==
path
)
{
if
(
!
draft
.
sync
&&
window
.
confirm
(
'“'
+
getFileName
(
path
)
+
'”在草稿箱包含未保存的更改,确定加载网盘版本覆盖草稿箱中的版本吗?'
)
)
{
setRemotePath
(
path
,
true
);
loadRemote
();
}
}
else
{
draft
=
draftManager
.
openByPath
(
path
);
setRemotePath
(
path
,
!
draft
||
draft
.
sync
);
if
(
draft
)
{
draftManager
.
load
();
}
else
{
loadRemote
();
}
}
}
// 新建文件
...
...
@@ -338,28 +356,35 @@ $( function () {
var
data
=
minder
.
exportData
(
'json'
);
var
sto
=
baidu
.
frontia
.
personalStorage
;
try
{
sto
.
uploadTextFile
(
data
,
remotePath
||
generateRemotePath
(),
{
ondup
:
remotePath
?
sto
.
constant
.
ONDUP_OVERWRITE
:
sto
.
constant
.
ONDUP_NEWCOPY
,
success
:
function
(
savedFile
)
{
if
(
savedFile
.
path
)
{
if
(
!
remotePath
)
{
addToRecentMenu
(
[
savedFile
]
);
}
setRemotePath
(
savedFile
.
path
,
true
);
$save_btn
.
text
(
'已保存!'
);
function
error
(
reason
)
{
notice
(
reason
+
'
\
n建议您将脑图以 .km 格式导出到本地!'
);
$save_btn
.
loading
(
false
);
clearTimeout
(
timeout
);
}
var
timeout
=
setTimeout
(
function
()
{
error
(
'保存到云盘超时,可能是网络不稳定导致。'
);
},
15000
);
sto
.
uploadTextFile
(
data
,
remotePath
||
generateRemotePath
(),
{
ondup
:
remotePath
?
sto
.
constant
.
ONDUP_OVERWRITE
:
sto
.
constant
.
ONDUP_NEWCOPY
,
success
:
function
(
savedFile
)
{
if
(
savedFile
.
path
)
{
if
(
!
remotePath
)
{
addToRecentMenu
(
[
savedFile
]
);
}
setRemotePath
(
savedFile
.
path
,
true
);
draftManager
.
save
(
remotePath
);
},
error
:
function
(
error
)
{
notice
(
'保存到云盘失败,建议您将脑图以 .km 格式导出到本地!'
);
$save_btn
.
loading
(
false
);
draftManager
.
sync
();
clearTimeout
(
timeout
);
}
else
{
error
(
'保存到云盘失败,可能是网络问题导致!'
);
}
}
);
}
catch
(
e
)
{
notice
(
'保存到云盘失败:'
+
e
.
message
+
'
\
n建议您将脑图以 .km 格式导出到本地!
'
);
$save_btn
.
loading
(
false
);
}
}
,
error
:
function
(
e
)
{
error
(
'保存到云盘失败
'
);
}
}
);
$save_btn
.
loading
(
'正在保存...'
);
}
...
...
@@ -527,10 +552,11 @@ $( function () {
isRemote
=
draft
.
path
.
indexOf
(
'/apps/kityminder'
)
===
0
;
if
(
isRemote
)
{
setRemotePath
(
draft
.
path
,
false
);
setRemotePath
(
draft
.
path
,
draft
.
sync
);
}
watchingChanges
=
false
;
draftManager
.
load
();
watchingChanges
=
true
;
if
(
!
isRemote
)
{
setRemotePath
(
null
,
false
);
}
...
...
spec/testdesign/Manual regression cases.xmind
View file @
d6ac76bc
No preview for this file type
src/module/view.js
View file @
d6ac76bc
...
...
@@ -104,6 +104,7 @@ KityMinder.registerModule( 'View', function () {
var
dx
=
viewport
.
center
.
x
-
offset
.
x
-
offset
.
width
/
2
,
dy
=
viewport
.
center
.
y
-
offset
.
y
;
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
1000
,
"easeOutQuint"
);
this
.
setContentChanged
(
false
);
}
}
);
...
...
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