Refresh file on reconnect
This commit is contained in:
parent
3ddbc065e9
commit
f34273ed89
|
@ -752,6 +752,13 @@
|
|||
});
|
||||
};
|
||||
|
||||
var _refreshFile = function(data) {
|
||||
_sendCommand({
|
||||
command: 'refreshFile',
|
||||
data: data
|
||||
});
|
||||
};
|
||||
|
||||
var _serviceCommand = function(command, data) {
|
||||
_sendCommand({
|
||||
command: 'internalCommand',
|
||||
|
@ -787,7 +794,8 @@
|
|||
requestClose : _requestClose,
|
||||
grabFocus : _grabFocus,
|
||||
blurFocus : _blurFocus,
|
||||
setReferenceData : _setReferenceData
|
||||
setReferenceData : _setReferenceData,
|
||||
refreshFile : _refreshFile
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -142,6 +142,10 @@ if (window.Common === undefined) {
|
|||
|
||||
'setReferenceData': function(data) {
|
||||
$me.trigger('setreferencedata', data);
|
||||
},
|
||||
|
||||
'refreshFile': function(data) {
|
||||
$me.trigger('refreshfile', data);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -359,6 +363,10 @@ if (window.Common === undefined) {
|
|||
_postMessage({ event: 'onPluginsReady' });
|
||||
},
|
||||
|
||||
requestRefreshFile: function() {
|
||||
_postMessage({ event: 'onRequestRefreshFile' });
|
||||
},
|
||||
|
||||
on: function(event, handler){
|
||||
var localHandler = function(event, data){
|
||||
handler.call(me, data)
|
||||
|
|
|
@ -226,6 +226,9 @@ define([
|
|||
Common.NotificationCenter.on('showerror', _.bind(this.onError, this));
|
||||
Common.NotificationCenter.on('editing:disable', _.bind(this.onEditingDisable, this));
|
||||
|
||||
Common.Gateway.on('refreshfile', _.bind(this.onRefreshFile, this));
|
||||
this.api.asc_registerCallback('asc_onRequestRefreshFile', _.bind(this.onRequestRefreshFile, this));
|
||||
|
||||
this.isShowOpenDialog = false;
|
||||
|
||||
// Initialize api gateway
|
||||
|
@ -2995,6 +2998,28 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onRequestRefreshFile: function() {
|
||||
Common.Gateway.requestRefreshFile();
|
||||
},
|
||||
|
||||
onRefreshFile: function(data) {
|
||||
if (data) {
|
||||
var docInfo = new Asc.asc_CDocInfo();
|
||||
if (data.document) {
|
||||
docInfo.put_Id(data.document.key);
|
||||
docInfo.put_Url(data.document.url);
|
||||
docInfo.put_Title(data.document.title);
|
||||
data.document.title && Common.Gateway.metaChange({title: data.document.title});
|
||||
}
|
||||
if (data.editorConfig) {
|
||||
docInfo.put_CallbackUrl(data.editorConfig.callbackUrl);
|
||||
}
|
||||
if (data.token)
|
||||
docInfo.put_Token(data.token);
|
||||
this.api.asc_setDocInfo(docInfo);
|
||||
}
|
||||
},
|
||||
|
||||
leavePageText: 'You have unsaved changes in this document. Click \'Stay on this Page\' then \'Save\' to save them. Click \'Leave this Page\' to discard all the unsaved changes.',
|
||||
criticalErrorTitle: 'Error',
|
||||
notcriticalErrorTitle: 'Warning',
|
||||
|
|
Loading…
Reference in a new issue