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
6f777edf
Commit
6f777edf
authored
Feb 17, 2017
by
konovalovsergey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for forceSave button
parent
4f2d6498
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
26 deletions
+68
-26
cell/api.js
cell/api.js
+12
-3
common/apiBase.js
common/apiBase.js
+5
-0
common/docscoapi.js
common/docscoapi.js
+13
-8
slide/api.js
slide/api.js
+19
-8
word/api.js
word/api.js
+19
-7
No files found.
cell/api.js
View file @
6f777edf
...
@@ -313,13 +313,17 @@ var editor;
...
@@ -313,13 +313,17 @@ var editor;
};
};
spreadsheet_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
)
{
spreadsheet_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
)
{
this
.
IsUserSave
=
!
isAutoSave
;
if
(
!
this
.
canSave
||
this
.
isChartEditor
||
c_oAscAdvancedOptionsAction
.
None
!==
this
.
advancedOptionsAction
||
if
(
!
this
.
canSave
||
this
.
isChartEditor
||
c_oAscAdvancedOptionsAction
.
None
!==
this
.
advancedOptionsAction
||
this
.
isLongAction
()
||
this
.
isLongAction
())
{
!
(
this
.
asc_isDocumentCanSave
()
||
this
.
collaborativeEditing
.
haveOtherChanges
()
||
this
.
canUnlockDocument
))
{
return
;
}
else
if
(
!
(
this
.
asc_isDocumentCanSave
()
||
this
.
collaborativeEditing
.
haveOtherChanges
()
||
this
.
canUnlockDocument
))
{
if
(
this
.
isForceSaveOnUserSave
&&
this
.
IsUserSave
)
{
this
.
forceSave
();
}
return
;
return
;
}
}
this
.
IsUserSave
=
!
isAutoSave
;
if
(
this
.
IsUserSave
)
{
if
(
this
.
IsUserSave
)
{
this
.
sync_StartAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
Save
);
this
.
sync_StartAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
Save
);
}
}
...
@@ -1450,6 +1454,9 @@ var editor;
...
@@ -1450,6 +1454,9 @@ var editor;
this
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
{
this
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
{
t
.
CoAuthoringApi
.
onUnSaveLock
=
null
;
t
.
CoAuthoringApi
.
onUnSaveLock
=
null
;
if
(
t
.
isForceSaveOnUserSave
&&
t
.
IsUserSave
)
{
t
.
forceSave
();
}
if
(
t
.
collaborativeEditing
.
getCollaborativeEditing
())
{
if
(
t
.
collaborativeEditing
.
getCollaborativeEditing
())
{
// Шлем update для toolbar-а, т.к. когда select в lock ячейке нужно заблокировать toolbar
// Шлем update для toolbar-а, т.к. когда select в lock ячейке нужно заблокировать toolbar
...
@@ -3293,6 +3300,8 @@ var editor;
...
@@ -3293,6 +3300,8 @@ var editor;
prot
[
"
asc_LoadEmptyDocument
"
]
=
prot
.
asc_LoadEmptyDocument
;
prot
[
"
asc_LoadEmptyDocument
"
]
=
prot
.
asc_LoadEmptyDocument
;
prot
[
"
asc_DownloadAs
"
]
=
prot
.
asc_DownloadAs
;
prot
[
"
asc_DownloadAs
"
]
=
prot
.
asc_DownloadAs
;
prot
[
"
asc_Save
"
]
=
prot
.
asc_Save
;
prot
[
"
asc_Save
"
]
=
prot
.
asc_Save
;
prot
[
"
forceSave
"
]
=
prot
.
forceSave
;
prot
[
"
asc_setIsForceSaveOnUserSave
"
]
=
prot
.
asc_setIsForceSaveOnUserSave
;
prot
[
"
asc_Print
"
]
=
prot
.
asc_Print
;
prot
[
"
asc_Print
"
]
=
prot
.
asc_Print
;
prot
[
"
asc_Resize
"
]
=
prot
.
asc_Resize
;
prot
[
"
asc_Resize
"
]
=
prot
.
asc_Resize
;
prot
[
"
asc_Copy
"
]
=
prot
.
asc_Copy
;
prot
[
"
asc_Copy
"
]
=
prot
.
asc_Copy
;
...
...
common/apiBase.js
View file @
6f777edf
...
@@ -139,6 +139,7 @@
...
@@ -139,6 +139,7 @@
this
.
canSave
=
true
;
// Флаг нужен чтобы не происходило сохранение пока не завершится предыдущее сохранение
this
.
canSave
=
true
;
// Флаг нужен чтобы не происходило сохранение пока не завершится предыдущее сохранение
this
.
IsUserSave
=
false
;
// Флаг, контролирующий сохранение было сделано пользователем или нет (по умолчанию - нет)
this
.
IsUserSave
=
false
;
// Флаг, контролирующий сохранение было сделано пользователем или нет (по умолчанию - нет)
this
.
isForceSaveOnUserSave
=
false
;
// Version History
// Version History
this
.
VersionHistory
=
null
;
// Объект, который отвечает за точку в списке версий
this
.
VersionHistory
=
null
;
// Объект, который отвечает за точку в списке версий
...
@@ -487,6 +488,10 @@
...
@@ -487,6 +488,10 @@
{
{
this
.
CoAuthoringApi
.
forceSave
()
this
.
CoAuthoringApi
.
forceSave
()
};
};
baseEditorsApi
.
prototype
.
asc_setIsForceSaveOnUserSave
=
function
(
val
)
{
this
.
isForceSaveOnUserSave
=
val
;
};
// Функция автосохранения. Переопределяется во всех редакторах
// Функция автосохранения. Переопределяется во всех редакторах
baseEditorsApi
.
prototype
.
_autoSave
=
function
()
{
baseEditorsApi
.
prototype
.
_autoSave
=
function
()
{
};
};
...
...
common/docscoapi.js
View file @
6f777edf
...
@@ -865,7 +865,11 @@
...
@@ -865,7 +865,11 @@
};
};
DocsCoApi
.
prototype
.
forceSave
=
function
()
{
DocsCoApi
.
prototype
.
forceSave
=
function
()
{
this
.
_send
({
'
type
'
:
'
forceSaveStart
'
});
var
newForceSaveButtonTime
=
Math
.
max
(
this
.
lastOtherSaveTime
,
this
.
lastOwnSaveTime
);
if
(
this
.
_lastForceSaveButtonTime
<
newForceSaveButtonTime
)
{
this
.
_lastForceSaveButtonTime
=
newForceSaveButtonTime
;
this
.
_send
({
'
type
'
:
'
forceSaveStart
'
});
}
};
};
DocsCoApi
.
prototype
.
openDocument
=
function
(
data
)
{
DocsCoApi
.
prototype
.
openDocument
=
function
(
data
)
{
...
@@ -971,7 +975,7 @@
...
@@ -971,7 +975,7 @@
},
timeout
);
},
timeout
);
}
}
};
};
DocsCoApi
.
prototype
.
_onForceSaveStart
=
function
(
data
)
{
DocsCoApi
.
prototype
.
_onForceSaveStart
=
function
(
data
)
{
if
(
data
[
'
code
'
]
===
c_oAscServerCommandErrors
.
NoError
)
{
if
(
data
[
'
code
'
]
===
c_oAscServerCommandErrors
.
NoError
)
{
this
.
_lastForceSaveButtonTime
=
data
[
'
time
'
];
this
.
_lastForceSaveButtonTime
=
data
[
'
time
'
];
...
@@ -982,9 +986,10 @@
...
@@ -982,9 +986,10 @@
DocsCoApi
.
prototype
.
_onForceSave
=
function
(
data
)
{
DocsCoApi
.
prototype
.
_onForceSave
=
function
(
data
)
{
if
(
c_oAscForceSaveTypes
.
Button
===
data
[
'
type
'
])
{
if
(
c_oAscForceSaveTypes
.
Button
===
data
[
'
type
'
])
{
if
(
this
.
_lastForceSaveButtonTime
==
data
[
'
time
'
])
{
if
(
this
.
_lastForceSaveButtonTime
==
data
[
'
time
'
])
{
this
.
onForceSave
({
type
:
c_oAscForceSaveTypes
.
Button
,
saved
:
true
});
this
.
onForceSave
({
type
:
c_oAscForceSaveTypes
.
Button
,
saved
:
true
});
}
}
}
else
if
(
c_oAscForceSaveTypes
.
Timeout
===
data
[
'
type
'
])
{
}
if
(
null
!=
this
.
_lastForceSaveTime
)
{
this
.
_lastForceSaveTime
=
data
[
'
time
'
];
this
.
_lastForceSaveTime
=
data
[
'
time
'
];
this
.
_checkLastForceSave
();
this
.
_checkLastForceSave
();
}
}
...
@@ -992,13 +997,13 @@
...
@@ -992,13 +997,13 @@
DocsCoApi
.
prototype
.
_checkLastForceSave
=
function
(
data
)
{
DocsCoApi
.
prototype
.
_checkLastForceSave
=
function
(
data
)
{
if
(
null
!=
this
.
_lastForceSaveTime
)
{
if
(
null
!=
this
.
_lastForceSaveTime
)
{
var
newState
=
false
;
var
newState
=
false
;
if
((
-
1
==
this
.
lastOtherSaveTime
||
this
.
lastOtherSaveTime
<=
this
.
_lastForceSaveTime
)
&&
if
((
-
1
==
this
.
lastOtherSaveTime
||
this
.
lastOtherSaveTime
<=
this
.
_lastForceSaveTime
)
&&
(
-
1
==
this
.
lastOwnSaveTime
||
this
.
lastOwnSaveTime
<=
this
.
_lastForceSaveTime
))
{
(
-
1
==
this
.
lastOwnSaveTime
||
this
.
lastOwnSaveTime
<=
this
.
_lastForceSaveTime
))
{
newState
=
true
;
newState
=
true
;
}
}
if
(
newState
!=
this
.
_allChangesSaved
)
{
if
(
newState
!=
this
.
_allChangesSaved
)
{
this
.
_allChangesSaved
=
newState
;
this
.
_allChangesSaved
=
newState
;
this
.
onForceSave
({
type
:
c_oAscForceSaveTypes
.
Timeout
,
saved
:
this
.
_allChangesSaved
});
this
.
onForceSave
({
type
:
c_oAscForceSaveTypes
.
Timeout
,
saved
:
this
.
_allChangesSaved
});
}
}
}
}
};
};
...
...
slide/api.js
View file @
6f777edf
...
@@ -1847,7 +1847,9 @@ background-repeat: no-repeat;\
...
@@ -1847,7 +1847,9 @@ background-repeat: no-repeat;\
this
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
this
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
{
{
t
.
CoAuthoringApi
.
onUnSaveLock
=
null
;
t
.
CoAuthoringApi
.
onUnSaveLock
=
null
;
if
(
t
.
isForceSaveOnUserSave
&&
t
.
IsUserSave
)
{
t
.
forceSave
();
}
// Выставляем, что документ не модифицирован
// Выставляем, что документ не модифицирован
t
.
CheckChangedDocument
();
t
.
CheckChangedDocument
();
t
.
canSave
=
true
;
t
.
canSave
=
true
;
...
@@ -1947,16 +1949,23 @@ background-repeat: no-repeat;\
...
@@ -1947,16 +1949,23 @@ background-repeat: no-repeat;\
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
,
isUndoRequest
)
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
,
isUndoRequest
)
{
{
this
.
IsUserSave
=
!
isAutoSave
;
this
.
IsUserSave
=
!
isAutoSave
;
if
(
true
===
this
.
canSave
&&
!
this
.
isLongAction
()
&&
(
this
.
asc_isDocumentCanSave
()
||
History
.
Have_Changes
()
||
if
(
true
===
this
.
canSave
&&
!
this
.
isLongAction
())
AscCommon
.
CollaborativeEditing
.
Have_OtherChanges
()
||
true
===
isUndoRequest
||
this
.
canUnlockDocument
))
{
{
this
.
canSave
=
false
;
if
(
this
.
asc_isDocumentCanSave
()
||
History
.
Have_Changes
()
||
AscCommon
.
CollaborativeEditing
.
Have_OtherChanges
()
||
true
===
isUndoRequest
||
this
.
canUnlockDocument
)
{
this
.
canSave
=
false
;
var
t
=
this
;
var
t
=
this
;
this
.
CoAuthoringApi
.
askSaveChanges
(
function
(
e
)
this
.
CoAuthoringApi
.
askSaveChanges
(
function
(
e
)
{
t
.
onSaveCallback
(
e
,
isUndoRequest
);
});
}
else
if
(
this
.
isForceSaveOnUserSave
&&
this
.
IsUserSave
)
{
{
t
.
onSaveCallback
(
e
,
isUndoRequest
);
t
his
.
forceSave
(
);
}
);
}
}
}
};
};
asc_docs_api
.
prototype
.
asc_DownloadAs
=
function
(
typeFile
,
bIsDownloadEvent
)
asc_docs_api
.
prototype
.
asc_DownloadAs
=
function
(
typeFile
,
bIsDownloadEvent
)
...
@@ -6497,6 +6506,8 @@ background-repeat: no-repeat;\
...
@@ -6497,6 +6506,8 @@ background-repeat: no-repeat;\
asc_docs_api
.
prototype
[
'
Paste
'
]
=
asc_docs_api
.
prototype
.
Paste
;
asc_docs_api
.
prototype
[
'
Paste
'
]
=
asc_docs_api
.
prototype
.
Paste
;
asc_docs_api
.
prototype
[
'
Share
'
]
=
asc_docs_api
.
prototype
.
Share
;
asc_docs_api
.
prototype
[
'
Share
'
]
=
asc_docs_api
.
prototype
.
Share
;
asc_docs_api
.
prototype
[
'
asc_Save
'
]
=
asc_docs_api
.
prototype
.
asc_Save
;
asc_docs_api
.
prototype
[
'
asc_Save
'
]
=
asc_docs_api
.
prototype
.
asc_Save
;
asc_docs_api
.
prototype
[
'
forceSave
'
]
=
asc_docs_api
.
prototype
.
forceSave
;
asc_docs_api
.
prototype
[
'
asc_setIsForceSaveOnUserSave
'
]
=
asc_docs_api
.
prototype
.
asc_setIsForceSaveOnUserSave
;
asc_docs_api
.
prototype
[
'
asc_DownloadAs
'
]
=
asc_docs_api
.
prototype
.
asc_DownloadAs
;
asc_docs_api
.
prototype
[
'
asc_DownloadAs
'
]
=
asc_docs_api
.
prototype
.
asc_DownloadAs
;
asc_docs_api
.
prototype
[
'
Resize
'
]
=
asc_docs_api
.
prototype
.
Resize
;
asc_docs_api
.
prototype
[
'
Resize
'
]
=
asc_docs_api
.
prototype
.
Resize
;
asc_docs_api
.
prototype
[
'
AddURL
'
]
=
asc_docs_api
.
prototype
.
AddURL
;
asc_docs_api
.
prototype
[
'
AddURL
'
]
=
asc_docs_api
.
prototype
.
AddURL
;
...
...
word/api.js
View file @
6f777edf
...
@@ -1818,6 +1818,9 @@ background-repeat: no-repeat;\
...
@@ -1818,6 +1818,9 @@ background-repeat: no-repeat;\
this
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
this
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
{
{
t
.
CoAuthoringApi
.
onUnSaveLock
=
null
;
t
.
CoAuthoringApi
.
onUnSaveLock
=
null
;
if
(
t
.
isForceSaveOnUserSave
&&
t
.
IsUserSave
)
{
t
.
forceSave
();
}
// Выставляем, что документ не модифицирован
// Выставляем, что документ не модифицирован
t
.
CheckChangedDocument
();
t
.
CheckChangedDocument
();
...
@@ -1916,16 +1919,23 @@ background-repeat: no-repeat;\
...
@@ -1916,16 +1919,23 @@ background-repeat: no-repeat;\
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
,
isUndoRequest
)
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
,
isUndoRequest
)
{
{
this
.
IsUserSave
=
!
isAutoSave
;
this
.
IsUserSave
=
!
isAutoSave
;
if
(
true
===
this
.
canSave
&&
!
this
.
isLongAction
()
&&
(
this
.
asc_isDocumentCanSave
()
||
History
.
Have_Changes
()
||
if
(
true
===
this
.
canSave
&&
!
this
.
isLongAction
())
AscCommon
.
CollaborativeEditing
.
Have_OtherChanges
()
||
true
===
isUndoRequest
||
this
.
canUnlockDocument
))
{
{
this
.
canSave
=
false
;
if
(
this
.
asc_isDocumentCanSave
()
||
History
.
Have_Changes
()
||
AscCommon
.
CollaborativeEditing
.
Have_OtherChanges
()
||
true
===
isUndoRequest
||
this
.
canUnlockDocument
)
{
this
.
canSave
=
false
;
var
t
=
this
;
var
t
=
this
;
this
.
CoAuthoringApi
.
askSaveChanges
(
function
(
e
)
this
.
CoAuthoringApi
.
askSaveChanges
(
function
(
e
)
{
t
.
onSaveCallback
(
e
,
isUndoRequest
);
});
}
else
if
(
this
.
isForceSaveOnUserSave
&&
this
.
IsUserSave
)
{
{
t
.
onSaveCallback
(
e
,
isUndoRequest
);
t
his
.
forceSave
(
);
}
);
}
}
}
};
};
asc_docs_api
.
prototype
.
asc_DownloadOrigin
=
function
(
bIsDownloadEvent
)
asc_docs_api
.
prototype
.
asc_DownloadOrigin
=
function
(
bIsDownloadEvent
)
...
@@ -7540,6 +7550,8 @@ background-repeat: no-repeat;\
...
@@ -7540,6 +7550,8 @@ background-repeat: no-repeat;\
asc_docs_api
.
prototype
[
'
Paste
'
]
=
asc_docs_api
.
prototype
.
Paste
;
asc_docs_api
.
prototype
[
'
Paste
'
]
=
asc_docs_api
.
prototype
.
Paste
;
asc_docs_api
.
prototype
[
'
Share
'
]
=
asc_docs_api
.
prototype
.
Share
;
asc_docs_api
.
prototype
[
'
Share
'
]
=
asc_docs_api
.
prototype
.
Share
;
asc_docs_api
.
prototype
[
'
asc_Save
'
]
=
asc_docs_api
.
prototype
.
asc_Save
;
asc_docs_api
.
prototype
[
'
asc_Save
'
]
=
asc_docs_api
.
prototype
.
asc_Save
;
asc_docs_api
.
prototype
[
'
forceSave
'
]
=
asc_docs_api
.
prototype
.
forceSave
;
asc_docs_api
.
prototype
[
'
asc_setIsForceSaveOnUserSave
'
]
=
asc_docs_api
.
prototype
.
asc_setIsForceSaveOnUserSave
;
asc_docs_api
.
prototype
[
'
asc_DownloadAs
'
]
=
asc_docs_api
.
prototype
.
asc_DownloadAs
;
asc_docs_api
.
prototype
[
'
asc_DownloadAs
'
]
=
asc_docs_api
.
prototype
.
asc_DownloadAs
;
asc_docs_api
.
prototype
[
'
asc_DownloadAsMailMerge
'
]
=
asc_docs_api
.
prototype
.
asc_DownloadAsMailMerge
;
asc_docs_api
.
prototype
[
'
asc_DownloadAsMailMerge
'
]
=
asc_docs_api
.
prototype
.
asc_DownloadAsMailMerge
;
asc_docs_api
.
prototype
[
'
asc_DownloadOrigin
'
]
=
asc_docs_api
.
prototype
.
asc_DownloadOrigin
;
asc_docs_api
.
prototype
[
'
asc_DownloadOrigin
'
]
=
asc_docs_api
.
prototype
.
asc_DownloadOrigin
;
...
...
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