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
8f055633
Commit
8f055633
authored
Mar 25, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
草稿箱大小限制;文件编辑状态调整
parent
8057635b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
15 deletions
+13
-15
draftmanager.js
social/draftmanager.js
+5
-3
social.js
social/social.js
+7
-12
view.js
src/module/view.js
+1
-0
No files found.
social/draftmanager.js
View file @
8f055633
function
DraftManager
(
minder
)
{
function
DraftManager
(
minder
)
{
var
current
=
null
,
var
current
=
null
,
localStorage
=
window
.
localStorage
,
localStorage
=
window
.
localStorage
,
drafts
;
drafts
,
MAX_SIZE
=
15
;
init
();
init
();
...
@@ -32,7 +33,7 @@ function DraftManager( minder ) {
...
@@ -32,7 +33,7 @@ function DraftManager( minder ) {
}
}
function
store
()
{
function
store
()
{
localStorage
.
setItem
(
'drafts'
,
JSON
.
stringify
(
drafts
)
);
localStorage
.
setItem
(
'drafts'
,
JSON
.
stringify
(
drafts
.
slice
(
0
,
MAX_SIZE
)
)
);
}
}
function
create
(
path
)
{
function
create
(
path
)
{
...
@@ -84,6 +85,7 @@ function DraftManager( minder ) {
...
@@ -84,6 +85,7 @@ function DraftManager( minder ) {
current
.
update
=
new
Date
();
current
.
update
=
new
Date
();
store
();
store
();
}
}
return
current
;
}
}
function
sync
()
{
function
sync
()
{
...
@@ -92,7 +94,7 @@ function DraftManager( minder ) {
...
@@ -92,7 +94,7 @@ function DraftManager( minder ) {
}
}
function
list
()
{
function
list
()
{
return
drafts
.
slice
();
return
drafts
.
slice
(
0
,
15
);
}
}
function
remove
(
remove_index
)
{
function
remove
(
remove_index
)
{
...
...
social/social.js
View file @
8f055633
...
@@ -328,7 +328,9 @@ $( function () {
...
@@ -328,7 +328,9 @@ $( function () {
draft
=
draftManager
.
openByPath
(
path
);
draft
=
draftManager
.
openByPath
(
path
);
setRemotePath
(
path
,
!
draft
||
draft
.
sync
);
setRemotePath
(
path
,
!
draft
||
draft
.
sync
);
if
(
draft
)
{
if
(
draft
)
{
watchingChanges
=
false
;
draftManager
.
load
();
draftManager
.
load
();
watchingChanges
=
true
;
}
else
{
}
else
{
loadRemote
();
loadRemote
();
}
}
...
@@ -338,12 +340,9 @@ $( function () {
...
@@ -338,12 +340,9 @@ $( function () {
// 新建文件
// 新建文件
function
newFile
()
{
function
newFile
()
{
setRemotePath
(
null
,
true
);
setRemotePath
(
null
,
true
);
watchingChanges
=
false
;
minder
.
importData
(
'新建脑图'
,
'plain'
);
draftManager
.
create
();
draftManager
.
create
();
watchingChanges
=
true
;
minder
.
importData
(
'新建脑图'
,
'plain'
)
;
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
);
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
);
$user_btn
.
text
(
'<新建脑图>'
);
}
}
function
generateRemotePath
()
{
function
generateRemotePath
()
{
...
@@ -471,14 +470,10 @@ $( function () {
...
@@ -471,14 +470,10 @@ $( function () {
function
watchChanges
()
{
function
watchChanges
()
{
minder
.
on
(
'contentchange'
,
function
()
{
minder
.
on
(
'contentchange'
,
function
()
{
if
(
!
watchingChanges
)
return
;
if
(
!
watchingChanges
)
return
;
var
currentData
=
minder
.
exportData
(
'json'
);
var
current
=
draftManager
.
save
();
if
(
watchChanges
.
lastData
!=
currentData
)
{
if
(
currentAccount
)
{
if
(
currentAccount
)
{
$save_btn
.
disabled
(
current
.
sync
).
text
(
'保存'
);
$save_btn
.
disabled
(
false
).
text
(
'保存'
);
setRemotePath
(
remotePath
,
current
.
sync
);
watchChanges
.
lastData
=
currentData
;
setRemotePath
(
remotePath
,
false
);
}
draftManager
.
save
();
}
}
}
);
}
);
}
}
...
...
src/module/view.js
View file @
8f055633
...
@@ -89,6 +89,7 @@ KityMinder.registerModule( 'View', function () {
...
@@ -89,6 +89,7 @@ KityMinder.registerModule( 'View', function () {
}
else
{
}
else
{
minder
.
rollbackStatus
();
minder
.
rollbackStatus
();
}
}
this
.
setContentChanged
(
false
);
},
},
queryState
:
function
(
minder
)
{
queryState
:
function
(
minder
)
{
...
...
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