Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
f2a366fc
Commit
f2a366fc
authored
Feb 07, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move autosave timer to base api
parent
3685f419
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
81 deletions
+80
-81
cell/api.js
cell/api.js
+0
-3
common/Charts/DrawingObjects.js
common/Charts/DrawingObjects.js
+0
-2
common/apiBase.js
common/apiBase.js
+16
-0
slide/Drawing/HtmlPage.js
slide/Drawing/HtmlPage.js
+0
-38
slide/api.js
slide/api.js
+33
-0
word/Drawing/HtmlPage.js
word/Drawing/HtmlPage.js
+0
-38
word/api.js
word/api.js
+31
-0
No files found.
cell/api.js
View file @
f2a366fc
...
@@ -111,10 +111,7 @@ var editor;
...
@@ -111,10 +111,7 @@ var editor;
this
.
collaborativeEditing
=
null
;
this
.
collaborativeEditing
=
null
;
// AutoSave
// AutoSave
this
.
lastSaveTime
=
null
;
// Время последнего сохранения
this
.
autoSaveGapRealTime
=
30
;
// Интервал быстрого автосохранения (когда выставлен флаг realtime) - 30 мс.
this
.
autoSaveGapRealTime
=
30
;
// Интервал быстрого автосохранения (когда выставлен флаг realtime) - 30 мс.
this
.
autoSaveGapFast
=
2000
;
// Интервал быстрого автосохранения (когда человек один) - 2 сек.
this
.
autoSaveGapSlow
=
10
*
60
*
1000
;
// Интервал медленного автосохранения (когда совместно) - 10 минут
// Shapes
// Shapes
this
.
isStartAddShape
=
false
;
this
.
isStartAddShape
=
false
;
...
...
common/Charts/DrawingObjects.js
View file @
f2a366fc
...
@@ -1256,8 +1256,6 @@ function DrawingObjects() {
...
@@ -1256,8 +1256,6 @@ function DrawingObjects() {
_this
.
showDrawingObjectsEx
(
lastTask
.
params
.
clearCanvas
,
lastTask
.
params
.
graphicOption
,
lastTask
.
params
.
printOptions
);
_this
.
showDrawingObjectsEx
(
lastTask
.
params
.
clearCanvas
,
lastTask
.
params
.
graphicOption
,
lastTask
.
params
.
printOptions
);
aDrawTasks
.
splice
(
0
,
(
taskLen
-
1
>
0
)
?
taskLen
-
1
:
1
);
aDrawTasks
.
splice
(
0
,
(
taskLen
-
1
>
0
)
?
taskLen
-
1
:
1
);
}
}
api
.
_autoSave
();
}
}
//-----------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------
...
...
common/apiBase.js
View file @
f2a366fc
...
@@ -96,6 +96,15 @@
...
@@ -96,6 +96,15 @@
// AutoSave
// AutoSave
this
.
autoSaveGap
=
0
;
// Интервал автосохранения (0 - означает, что автосохранения нет) в милесекундах
this
.
autoSaveGap
=
0
;
// Интервал автосохранения (0 - означает, что автосохранения нет) в милесекундах
this
.
lastSaveTime
=
null
;
// Время последнего сохранения
this
.
autoSaveGapFast
=
2000
;
// Интервал быстрого автосохранения (когда человек один) - 2 сек.
this
.
autoSaveGapSlow
=
10
*
60
*
1000
;
// Интервал медленного автосохранения (когда совместно) - 10 минут
this
.
intervalWaitAutoSave
=
1000
;
// Unlock document
this
.
canUnlockDocument
=
false
;
this
.
canUnlockDocument2
=
false
;
// Дублирующий флаг, только для saveChanges или unLockDocument
this
.
canStartCoAuthoring
=
false
;
this
.
isDocumentCanSave
=
false
;
// Флаг, говорит о возможности сохранять документ (активна кнопка save или нет)
this
.
isDocumentCanSave
=
false
;
// Флаг, говорит о возможности сохранять документ (активна кнопка save или нет)
...
@@ -477,6 +486,9 @@
...
@@ -477,6 +486,9 @@
{
{
this
.
CoAuthoringApi
.
forceSave
()
this
.
CoAuthoringApi
.
forceSave
()
};
};
// Функция автосохранения. Переопределяется во всех редакторах
baseEditorsApi
.
prototype
.
_autoSave
=
function
()
{
};
// Выставление интервала автосохранения (0 - означает, что автосохранения нет)
// Выставление интервала автосохранения (0 - означает, что автосохранения нет)
baseEditorsApi
.
prototype
.
asc_setAutoSaveGap
=
function
(
autoSaveGap
)
baseEditorsApi
.
prototype
.
asc_setAutoSaveGap
=
function
(
autoSaveGap
)
{
{
...
@@ -982,6 +994,10 @@
...
@@ -982,6 +994,10 @@
}
}
this
.
pluginsManager
=
Asc
.
createPluginsManager
(
this
);
this
.
pluginsManager
=
Asc
.
createPluginsManager
(
this
);
if
(
!
window
[
'
IS_NATIVE_EDITOR
'
])
{
setInterval
(
function
()
{
t
.
_autoSave
();},
40
);
}
};
};
baseEditorsApi
.
prototype
.
sendStandartTextures
=
function
()
baseEditorsApi
.
prototype
.
sendStandartTextures
=
function
()
...
...
slide/Drawing/HtmlPage.js
View file @
f2a366fc
...
@@ -329,11 +329,6 @@ function CEditorPage(api)
...
@@ -329,11 +329,6 @@ function CEditorPage(api)
this
.
IsUseNullThumbnailsSplitter
=
false
;
this
.
IsUseNullThumbnailsSplitter
=
false
;
this
.
m_nIntervalSlowAutosave
=
600000
;
this
.
m_nIntervalFastAutosave
=
2000
;
this
.
m_nIntervalWaitAutoSave
=
1000
;
this
.
m_nLastAutosaveTime
=
-
1
;
this
.
NoneRepaintPages
=
false
;
this
.
NoneRepaintPages
=
false
;
this
.
m_oApi
=
api
;
this
.
m_oApi
=
api
;
...
@@ -3137,8 +3132,6 @@ function CEditorPage(api)
...
@@ -3137,8 +3132,6 @@ function CEditorPage(api)
return
;
return
;
}
}
oWordControl
.
m_nTimeDrawingLast
=
new
Date
().
getTime
();
var
isRepaint
=
oWordControl
.
m_bIsScroll
;
var
isRepaint
=
oWordControl
.
m_bIsScroll
;
if
(
oWordControl
.
m_bIsScroll
)
if
(
oWordControl
.
m_bIsScroll
)
{
{
...
@@ -3166,36 +3159,6 @@ function CEditorPage(api)
...
@@ -3166,36 +3159,6 @@ function CEditorPage(api)
oWordControl
.
m_oDrawingDocument
.
Collaborative_TargetsUpdate
(
isRepaint
);
oWordControl
.
m_oDrawingDocument
.
Collaborative_TargetsUpdate
(
isRepaint
);
if
(
oWordControl
.
m_oApi
.
autoSaveGap
!=
0
&&
!
oWordControl
.
m_oApi
.
isViewMode
)
{
var
_curTime
=
new
Date
().
getTime
();
if
(
-
1
==
oWordControl
.
m_nLastAutosaveTime
)
{
oWordControl
.
m_nLastAutosaveTime
=
_curTime
;
}
var
_bIsWaitScheme
=
false
;
if
(
History
.
Points
&&
History
.
Index
>=
0
&&
History
.
Index
<
History
.
Points
.
length
)
{
if
((
_curTime
-
History
.
Points
[
History
.
Index
].
Time
)
<
oWordControl
.
m_nIntervalWaitAutoSave
)
_bIsWaitScheme
=
true
;
}
if
(
!
_bIsWaitScheme
)
{
var
_interval
=
(
AscCommon
.
CollaborativeEditing
.
m_nUseType
<=
0
)
?
oWordControl
.
m_nIntervalSlowAutosave
:
oWordControl
.
m_nIntervalFastAutosave
;
if
((
_curTime
-
oWordControl
.
m_nLastAutosaveTime
)
>
_interval
&&
!
oWordControl
.
m_oDrawingDocument
.
TransitionSlide
.
IsPlaying
()
&&
!
oWordControl
.
m_oApi
.
isLongAction
())
{
if
(
History
.
Have_Changes
(
true
)
==
true
)
{
oWordControl
.
m_oApi
.
asc_Save
(
true
);
}
oWordControl
.
m_nLastAutosaveTime
=
_curTime
;
}
}
}
oWordControl
.
m_nPaintTimerId
=
setTimeout
(
oWordControl
.
onTimerScroll
,
oWordControl
.
m_nTimerScrollInterval
);
oWordControl
.
m_nPaintTimerId
=
setTimeout
(
oWordControl
.
onTimerScroll
,
oWordControl
.
m_nTimerScrollInterval
);
//window.requestAnimationFrame(oWordControl.onTimerScroll);
//window.requestAnimationFrame(oWordControl.onTimerScroll);
};
};
...
@@ -3203,7 +3166,6 @@ function CEditorPage(api)
...
@@ -3203,7 +3166,6 @@ function CEditorPage(api)
this
.
onTimerScroll_sync
=
function
(
isThUpdateSync
)
this
.
onTimerScroll_sync
=
function
(
isThUpdateSync
)
{
{
var
oWordControl
=
oThis
;
var
oWordControl
=
oThis
;
oWordControl
.
m_nTimeDrawingLast
=
new
Date
().
getTime
();
var
isRepaint
=
oWordControl
.
m_bIsScroll
;
var
isRepaint
=
oWordControl
.
m_bIsScroll
;
if
(
oWordControl
.
m_bIsScroll
)
if
(
oWordControl
.
m_bIsScroll
)
{
{
...
...
slide/api.js
View file @
f2a366fc
...
@@ -1892,7 +1892,40 @@ background-repeat: no-repeat;\
...
@@ -1892,7 +1892,40 @@ background-repeat: no-repeat;\
}
}
}
}
};
};
asc_docs_api
.
prototype
.
_autoSave
=
function
()
{
if
((
this
.
canUnlockDocument
||
this
.
autoSaveGap
!=
0
)
&&
!
this
.
isViewMode
)
{
var
_curTime
=
new
Date
().
getTime
();
if
(
-
1
===
this
.
lastSaveTime
)
{
this
.
lastSaveTime
=
_curTime
;
}
if
(
this
.
canUnlockDocument
)
{
this
.
asc_Save
(
true
);
this
.
lastSaveTime
=
_curTime
;
}
else
{
var
_bIsWaitScheme
=
false
;
if
(
this
.
WordControl
.
m_oDrawingDocument
&&
!
this
.
WordControl
.
m_oDrawingDocument
.
TransitionSlide
.
IsPlaying
()
&&
History
.
Points
&&
History
.
Index
>=
0
&&
History
.
Index
<
History
.
Points
.
length
)
{
if
((
_curTime
-
History
.
Points
[
History
.
Index
].
Time
)
<
this
.
intervalWaitAutoSave
)
{
_bIsWaitScheme
=
true
;
}
}
if
(
!
_bIsWaitScheme
)
{
var
_interval
=
(
AscCommon
.
CollaborativeEditing
.
m_nUseType
<=
0
)
?
this
.
autoSaveGapSlow
:
this
.
autoSaveGapFast
;
if
((
_curTime
-
this
.
lastSaveTime
)
>
_interval
)
{
if
(
History
.
Have_Changes
(
true
)
==
true
)
{
this
.
asc_Save
(
true
);
}
this
.
lastSaveTime
=
_curTime
;
}
}
}
}
};
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
)
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
)
{
{
this
.
IsUserSave
=
!
isAutoSave
;
this
.
IsUserSave
=
!
isAutoSave
;
...
...
word/Drawing/HtmlPage.js
View file @
f2a366fc
...
@@ -201,18 +201,12 @@ function CEditorPage(api)
...
@@ -201,18 +201,12 @@ function CEditorPage(api)
this
.
m_oScrollHorApi
=
null
;
this
.
m_oScrollHorApi
=
null
;
this
.
m_oScrollVerApi
=
null
;
this
.
m_oScrollVerApi
=
null
;
this
.
m_nIntervalSlowAutosave
=
600000
;
this
.
m_nIntervalFastAutosave
=
2000
;
this
.
m_nIntervalWaitAutoSave
=
1000
;
this
.
m_nLastAutosaveTime
=
-
1
;
this
.
arrayEventHandlers
=
[];
this
.
arrayEventHandlers
=
[];
this
.
m_oTimerScrollSelect
=
-
1
;
this
.
m_oTimerScrollSelect
=
-
1
;
this
.
IsFocus
=
true
;
this
.
IsFocus
=
true
;
this
.
m_bIsMouseLock
=
false
;
this
.
m_bIsMouseLock
=
false
;
this
.
m_nTimeDrawingLast
=
0
;
this
.
DrawingFreeze
=
false
;
this
.
DrawingFreeze
=
false
;
this
.
m_oHorRuler
.
m_oWordControl
=
this
;
this
.
m_oHorRuler
.
m_oWordControl
=
this
;
...
@@ -3574,7 +3568,6 @@ function CEditorPage(api)
...
@@ -3574,7 +3568,6 @@ function CEditorPage(api)
if
(
oWordControl
.
m_oApi
.
isLongAction
())
if
(
oWordControl
.
m_oApi
.
isLongAction
())
return
;
return
;
oWordControl
.
m_nTimeDrawingLast
=
new
Date
().
getTime
();
var
isRepaint
=
oWordControl
.
m_bIsScroll
;
var
isRepaint
=
oWordControl
.
m_bIsScroll
;
if
(
oWordControl
.
m_bIsScroll
)
if
(
oWordControl
.
m_bIsScroll
)
{
{
...
@@ -3597,36 +3590,6 @@ function CEditorPage(api)
...
@@ -3597,36 +3590,6 @@ function CEditorPage(api)
oWordControl
.
m_oDrawingDocument
.
Collaborative_TargetsUpdate
(
isRepaint
);
oWordControl
.
m_oDrawingDocument
.
Collaborative_TargetsUpdate
(
isRepaint
);
if
(
oWordControl
.
m_oApi
.
autoSaveGap
!=
0
&&
!
oWordControl
.
m_oApi
.
isViewMode
)
{
var
_curTime
=
new
Date
().
getTime
();
if
(
-
1
==
oWordControl
.
m_nLastAutosaveTime
)
{
oWordControl
.
m_nLastAutosaveTime
=
_curTime
;
}
var
_bIsWaitScheme
=
false
;
if
(
History
.
Points
&&
History
.
Index
>=
0
&&
History
.
Index
<
History
.
Points
.
length
)
{
if
((
_curTime
-
History
.
Points
[
History
.
Index
].
Time
)
<
oWordControl
.
m_nIntervalWaitAutoSave
)
_bIsWaitScheme
=
true
;
}
if
(
!
_bIsWaitScheme
)
{
var
_interval
=
(
AscCommon
.
CollaborativeEditing
.
m_nUseType
<=
0
)
?
oWordControl
.
m_nIntervalSlowAutosave
:
oWordControl
.
m_nIntervalFastAutosave
;
if
((
_curTime
-
oWordControl
.
m_nLastAutosaveTime
)
>
_interval
)
{
if
(
History
.
Have_Changes
(
true
)
==
true
)
{
oWordControl
.
m_oApi
.
asc_Save
(
true
);
}
oWordControl
.
m_nLastAutosaveTime
=
_curTime
;
}
}
}
oWordControl
.
m_oApi
.
sendEvent
(
"
asc_onPaintTimer
"
);
oWordControl
.
m_oApi
.
sendEvent
(
"
asc_onPaintTimer
"
);
//window.requestAnimationFrame(oWordControl.onTimerScroll2);
//window.requestAnimationFrame(oWordControl.onTimerScroll2);
};
};
...
@@ -3651,7 +3614,6 @@ function CEditorPage(api)
...
@@ -3651,7 +3614,6 @@ function CEditorPage(api)
if
(
!
oWordControl
.
m_oApi
.
bInit_word_control
||
oWordControl
.
m_oApi
.
isOnlyReaderMode
)
if
(
!
oWordControl
.
m_oApi
.
bInit_word_control
||
oWordControl
.
m_oApi
.
isOnlyReaderMode
)
return
;
return
;
oWordControl
.
m_nTimeDrawingLast
=
new
Date
().
getTime
();
var
isRepaint
=
oWordControl
.
m_bIsScroll
;
var
isRepaint
=
oWordControl
.
m_bIsScroll
;
if
(
oWordControl
.
m_bIsScroll
)
if
(
oWordControl
.
m_bIsScroll
)
{
{
...
...
word/api.js
View file @
f2a366fc
...
@@ -1872,7 +1872,38 @@ background-repeat: no-repeat;\
...
@@ -1872,7 +1872,38 @@ background-repeat: no-repeat;\
}
}
}
}
};
};
asc_docs_api
.
prototype
.
_autoSave
=
function
()
{
if
((
this
.
canUnlockDocument
||
this
.
autoSaveGap
!=
0
)
&&
!
this
.
isViewMode
)
{
var
_curTime
=
new
Date
().
getTime
();
if
(
-
1
===
this
.
lastSaveTime
)
{
this
.
lastSaveTime
=
_curTime
;
}
if
(
this
.
canUnlockDocument
)
{
this
.
asc_Save
(
true
);
this
.
lastSaveTime
=
_curTime
;
}
else
{
var
_bIsWaitScheme
=
false
;
if
(
History
.
Points
&&
History
.
Index
>=
0
&&
History
.
Index
<
History
.
Points
.
length
)
{
if
((
_curTime
-
History
.
Points
[
History
.
Index
].
Time
)
<
this
.
intervalWaitAutoSave
)
{
_bIsWaitScheme
=
true
;
}
}
if
(
!
_bIsWaitScheme
)
{
var
_interval
=
(
AscCommon
.
CollaborativeEditing
.
m_nUseType
<=
0
)
?
this
.
autoSaveGapSlow
:
this
.
autoSaveGapFast
;
if
((
_curTime
-
this
.
lastSaveTime
)
>
_interval
)
{
if
(
History
.
Have_Changes
(
true
)
==
true
)
{
this
.
asc_Save
(
true
);
}
this
.
lastSaveTime
=
_curTime
;
}
}
}
}
};
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
,
isUndoRequest
)
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
,
isUndoRequest
)
{
{
this
.
IsUserSave
=
!
isAutoSave
;
this
.
IsUserSave
=
!
isAutoSave
;
...
...
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