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
1c3b6e65
Commit
1c3b6e65
authored
May 06, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move props from api -> Document.js
OnSave_Callback -> api.onSaveCallback
parent
ad595016
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
319 additions
and
301 deletions
+319
-301
slide/api.js
slide/api.js
+34
-28
word/Editor/Document.js
word/Editor/Document.js
+253
-1
word/api.js
word/api.js
+32
-272
No files found.
slide/api.js
View file @
1c3b6e65
...
@@ -1140,39 +1140,39 @@ asc_docs_api.prototype.Share = function(){
...
@@ -1140,39 +1140,39 @@ asc_docs_api.prototype.Share = function(){
};
};
asc_docs_api
.
prototype
.
onSaveCallback
=
function
(
e
)
{
function
OnSave_Callback
(
e
)
{
var
t
=
this
;
if
(
false
==
e
[
"
saveLock
"
])
{
if
(
false
==
e
[
"
saveLock
"
])
{
if
(
editor
.
isLongAction
())
{
if
(
this
.
isLongAction
())
{
// Мы не можем в этот момент сохранять, т.к. попали в ситуацию, когда мы залочили сохранение и успели нажать вставку до ответа
// Мы не можем в этот момент сохранять, т.к. попали в ситуацию, когда мы залочили сохранение и успели нажать вставку до ответа
// Нужно снять lock с сохранения
// Нужно снять lock с сохранения
editor
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
{
this
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
{
editor
.
canSave
=
true
;
t
.
canSave
=
true
;
editor
.
IsUserSave
=
false
;
t
.
IsUserSave
=
false
;
};
};
editor
.
CoAuthoringApi
.
unSaveLock
();
this
.
CoAuthoringApi
.
unSaveLock
();
return
;
return
;
}
}
editor
.
sync_StartAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
Save
);
this
.
sync_StartAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
Save
);
if
(
c_oAscCollaborativeMarksShowType
.
LastChanges
===
editor
.
CollaborativeMarksShowType
)
{
if
(
c_oAscCollaborativeMarksShowType
.
LastChanges
===
this
.
CollaborativeMarksShowType
)
{
AscCommon
.
CollaborativeEditing
.
Clear_CollaborativeMarks
();
AscCommon
.
CollaborativeEditing
.
Clear_CollaborativeMarks
();
}
}
// Принимаем чужие изменения
// Принимаем чужие изменения
AscCommon
.
CollaborativeEditing
.
Apply_Changes
();
AscCommon
.
CollaborativeEditing
.
Apply_Changes
();
editor
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
{
this
.
CoAuthoringApi
.
onUnSaveLock
=
function
()
{
editor
.
CoAuthoringApi
.
onUnSaveLock
=
null
;
t
.
CoAuthoringApi
.
onUnSaveLock
=
null
;
// Выставляем, что документ не модифицирован
// Выставляем, что документ не модифицирован
editor
.
CheckChangedDocument
();
t
.
CheckChangedDocument
();
editor
.
canSave
=
true
;
t
.
canSave
=
true
;
editor
.
IsUserSave
=
false
;
t
.
IsUserSave
=
false
;
editor
.
sync_EndAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
Save
);
t
.
sync_EndAction
(
c_oAscAsyncActionType
.
Information
,
c_oAscAsyncAction
.
Save
);
// Обновляем состояние возможности сохранения документа
// Обновляем состояние возможности сохранения документа
editor
.
_onUpdateDocumentCanSave
();
t
.
_onUpdateDocumentCanSave
();
if
(
undefined
!==
window
[
"
AscDesktopEditor
"
])
{
if
(
undefined
!==
window
[
"
AscDesktopEditor
"
])
{
window
[
"
AscDesktopEditor
"
][
"
OnSave
"
]();
window
[
"
AscDesktopEditor
"
][
"
OnSave
"
]();
...
@@ -1183,27 +1183,33 @@ function OnSave_Callback(e) {
...
@@ -1183,27 +1183,33 @@ function OnSave_Callback(e) {
CursorInfo
=
History
.
Get_DocumentPositionBinary
();
CursorInfo
=
History
.
Get_DocumentPositionBinary
();
}
}
// Пересылаем свои изменения
// Пересылаем свои изменения
AscCommon
.
CollaborativeEditing
.
Send_Changes
(
editor
.
IsUserSave
,
{
UserId
:
editor
.
CoAuthoringApi
.
getUserConnectionId
(),
UserShortId
:
editor
.
DocInfo
.
get_UserId
(),
CursorInfo
:
CursorInfo
});
AscCommon
.
CollaborativeEditing
.
Send_Changes
(
this
.
IsUserSave
,
{
UserId
:
this
.
CoAuthoringApi
.
getUserConnectionId
(),
UserShortId
:
this
.
DocInfo
.
get_UserId
(),
CursorInfo
:
CursorInfo
});
}
else
{
}
else
{
var
nState
=
editor
.
CoAuthoringApi
.
get_state
();
var
nState
=
this
.
CoAuthoringApi
.
get_state
();
if
(
AscCommon
.
ConnectionState
.
ClosedCoAuth
===
nState
||
AscCommon
.
ConnectionState
.
ClosedAll
===
nState
)
{
if
(
AscCommon
.
ConnectionState
.
ClosedCoAuth
===
nState
||
AscCommon
.
ConnectionState
.
ClosedAll
===
nState
)
{
// Отключаемся от сохранения, соединение потеряно
// Отключаемся от сохранения, соединение потеряно
editor
.
canSave
=
true
;
this
.
canSave
=
true
;
editor
.
IsUserSave
=
false
;
this
.
IsUserSave
=
false
;
}
else
{
}
else
{
var
TimeoutInterval
=
(
true
===
AscCommon
.
CollaborativeEditing
.
Is_Fast
()
?
1
:
1000
);
var
TimeoutInterval
=
(
true
===
AscCommon
.
CollaborativeEditing
.
Is_Fast
()
?
1
:
1000
);
setTimeout
(
function
()
{
setTimeout
(
function
()
{
editor
.
CoAuthoringApi
.
askSaveChanges
(
OnSave_Callback
);
t
.
CoAuthoringApi
.
askSaveChanges
(
function
(
event
)
{
t
.
onSaveCallback
(
event
);
});
},
TimeoutInterval
);
},
TimeoutInterval
);
}
}
}
}
}
}
;
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
)
{
asc_docs_api
.
prototype
.
asc_Save
=
function
(
isAutoSave
)
{
this
.
IsUserSave
=
!
isAutoSave
;
this
.
IsUserSave
=
!
isAutoSave
;
if
(
true
===
this
.
canSave
&&
!
this
.
isLongAction
())
{
if
(
true
===
this
.
canSave
&&
!
this
.
isLongAction
())
{
this
.
canSave
=
false
;
this
.
canSave
=
false
;
this
.
CoAuthoringApi
.
askSaveChanges
(
OnSave_Callback
);
var
t
=
this
;
this
.
CoAuthoringApi
.
askSaveChanges
(
function
(
e
)
{
t
.
onSaveCallback
(
e
);
});
}
}
};
};
asc_docs_api
.
prototype
.
asc_DownloadAs
=
function
(
typeFile
,
bIsDownloadEvent
){
//передаем число соответствующее своему формату.
asc_docs_api
.
prototype
.
asc_DownloadAs
=
function
(
typeFile
,
bIsDownloadEvent
){
//передаем число соответствующее своему формату.
...
...
word/Editor/Document.js
View file @
1c3b6e65
This diff is collapsed.
Click to expand it.
word/api.js
View file @
1c3b6e65
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