[SSE] Update external data
This commit is contained in:
parent
f60c3552c6
commit
398691700b
|
@ -23,6 +23,7 @@
|
||||||
options: <advanced options>,
|
options: <advanced options>,
|
||||||
key: 'key',
|
key: 'key',
|
||||||
vkey: 'vkey',
|
vkey: 'vkey',
|
||||||
|
referenceData: 'data for external paste',
|
||||||
info: {
|
info: {
|
||||||
owner: 'owner name',
|
owner: 'owner name',
|
||||||
folder: 'path to document',
|
folder: 'path to document',
|
||||||
|
@ -262,6 +263,7 @@
|
||||||
'onRequestCompareFile': <request file to compare>,// must call setRevisedFile method
|
'onRequestCompareFile': <request file to compare>,// must call setRevisedFile method
|
||||||
'onRequestSharingSettings': <request sharing settings>,// must call setSharingSettings method
|
'onRequestSharingSettings': <request sharing settings>,// must call setSharingSettings method
|
||||||
'onRequestCreateNew': <try to create document>,
|
'onRequestCreateNew': <try to create document>,
|
||||||
|
'onRequestReferenceData': <try to refresh external data>,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,6 +327,7 @@
|
||||||
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
|
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
|
||||||
_config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings;
|
_config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings;
|
||||||
_config.editorConfig.canRequestCreateNew = _config.events && !!_config.events.onRequestCreateNew;
|
_config.editorConfig.canRequestCreateNew = _config.events && !!_config.events.onRequestCreateNew;
|
||||||
|
_config.editorConfig.canRequestReferenceData = _config.events && !!_config.events.onRequestReferenceData;
|
||||||
_config.frameEditorId = placeholderId;
|
_config.frameEditorId = placeholderId;
|
||||||
_config.parentOrigin = window.location.origin;
|
_config.parentOrigin = window.location.origin;
|
||||||
|
|
||||||
|
@ -731,6 +734,13 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var _setReferenceData = function(data) {
|
||||||
|
_sendCommand({
|
||||||
|
command: 'setReferenceData',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var _serviceCommand = function(command, data) {
|
var _serviceCommand = function(command, data) {
|
||||||
_sendCommand({
|
_sendCommand({
|
||||||
command: 'internalCommand',
|
command: 'internalCommand',
|
||||||
|
@ -765,7 +775,8 @@
|
||||||
setFavorite : _setFavorite,
|
setFavorite : _setFavorite,
|
||||||
requestClose : _requestClose,
|
requestClose : _requestClose,
|
||||||
grabFocus : _grabFocus,
|
grabFocus : _grabFocus,
|
||||||
blurFocus : _blurFocus
|
blurFocus : _blurFocus,
|
||||||
|
setReferenceData : _setReferenceData
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,10 @@ if (window.Common === undefined) {
|
||||||
|
|
||||||
'grabFocus': function(data) {
|
'grabFocus': function(data) {
|
||||||
$me.trigger('grabfocus', data);
|
$me.trigger('grabfocus', data);
|
||||||
|
},
|
||||||
|
|
||||||
|
'setReferenceData': function(data) {
|
||||||
|
$me.trigger('setreferencedata', data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -347,6 +351,10 @@ if (window.Common === undefined) {
|
||||||
_postMessage({event:'onRequestCreateNew'});
|
_postMessage({event:'onRequestCreateNew'});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
requestReferenceData: function (data) {
|
||||||
|
_postMessage({event:'onRequestReferenceData', data: data});
|
||||||
|
},
|
||||||
|
|
||||||
pluginsReady: function() {
|
pluginsReady: function() {
|
||||||
_postMessage({ event: 'onPluginsReady' });
|
_postMessage({ event: 'onPluginsReady' });
|
||||||
},
|
},
|
||||||
|
|
|
@ -119,6 +119,11 @@ define([
|
||||||
me._state = {wsLock: false, wsProps: []};
|
me._state = {wsLock: false, wsProps: []};
|
||||||
me.fastcoauthtips = [];
|
me.fastcoauthtips = [];
|
||||||
me._TtHeight = 20;
|
me._TtHeight = 20;
|
||||||
|
me.externalData = {
|
||||||
|
stackRequests: [],
|
||||||
|
stackResponse: [],
|
||||||
|
callback: undefined
|
||||||
|
};
|
||||||
/** coauthoring begin **/
|
/** coauthoring begin **/
|
||||||
this.wrapEvents = {
|
this.wrapEvents = {
|
||||||
apiHideComment: _.bind(this.onApiHideComment, this)
|
apiHideComment: _.bind(this.onApiHideComment, this)
|
||||||
|
@ -369,6 +374,10 @@ define([
|
||||||
this.api.asc_registerCallback('asc_onShowPivotGroupDialog', _.bind(this.onShowPivotGroupDialog, this));
|
this.api.asc_registerCallback('asc_onShowPivotGroupDialog', _.bind(this.onShowPivotGroupDialog, this));
|
||||||
if (!this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle)
|
if (!this.permissions.isEditMailMerge && !this.permissions.isEditDiagram && !this.permissions.isEditOle)
|
||||||
this.api.asc_registerCallback('asc_doubleClickOnTableOleObject', _.bind(this.onDoubleClickOnTableOleObject, this));
|
this.api.asc_registerCallback('asc_doubleClickOnTableOleObject', _.bind(this.onDoubleClickOnTableOleObject, this));
|
||||||
|
if (this.permissions.canRequestReferenceData) {
|
||||||
|
this.api.asc_registerCallback('asc_onRefreshExternalData', _.bind(this.onRefreshExternalData, this));
|
||||||
|
Common.Gateway.on('setreferencedata', _.bind(this.setReferenceData, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this));
|
this.api.asc_registerCallback('asc_onShowForeignCursorLabel', _.bind(this.onShowForeignCursorLabel, this));
|
||||||
this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this));
|
this.api.asc_registerCallback('asc_onHideForeignCursorLabel', _.bind(this.onHideForeignCursorLabel, this));
|
||||||
|
@ -4082,6 +4091,51 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRefreshExternalData: function(arr, callback) {
|
||||||
|
if (this.permissions.isEdit && !this._isDisabled) {
|
||||||
|
var me = this;
|
||||||
|
me.externalData = {
|
||||||
|
stackRequests: [],
|
||||||
|
stackResponse: [],
|
||||||
|
callback: undefined
|
||||||
|
};
|
||||||
|
arr && arr.length>0 && arr.forEach(function(item) {
|
||||||
|
var data = {};
|
||||||
|
switch (item.type) {
|
||||||
|
case Asc.externalReferenceType.link:
|
||||||
|
data['link'] = item.data;
|
||||||
|
break;
|
||||||
|
case Asc.externalReferenceType.path:
|
||||||
|
data['path'] = item.data;
|
||||||
|
break;
|
||||||
|
case Asc.externalReferenceType.referenceData:
|
||||||
|
data['referenceData'] = item.data;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
me.externalData.stackRequests.push(data);
|
||||||
|
});
|
||||||
|
me.externalData.callback = callback;
|
||||||
|
me.requestReferenceData();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
requestReferenceData: function() {
|
||||||
|
if (this.externalData.stackRequests.length>0) {
|
||||||
|
var data = this.externalData.stackRequests.shift();
|
||||||
|
Common.Gateway.requestReferenceData(data);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setReferenceData: function(data) {
|
||||||
|
if (this.permissions.isEdit && !this._isDisabled) {
|
||||||
|
data && this.externalData.stackResponse.push(data);
|
||||||
|
if (this.externalData.stackRequests.length>0)
|
||||||
|
this.requestReferenceData();
|
||||||
|
else if (this.externalData.callback)
|
||||||
|
this.externalData.callback(this.externalData.stackResponse);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
getUserName: function(id){
|
getUserName: function(id){
|
||||||
var usersStore = SSE.getCollection('Common.Collections.Users');
|
var usersStore = SSE.getCollection('Common.Collections.Users');
|
||||||
if (usersStore){
|
if (usersStore){
|
||||||
|
|
|
@ -505,6 +505,7 @@ define([
|
||||||
docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys);
|
docInfo.put_EncryptedInfo(this.editorConfig.encryptionKeys);
|
||||||
docInfo.put_Lang(this.editorConfig.lang);
|
docInfo.put_Lang(this.editorConfig.lang);
|
||||||
docInfo.put_Mode(this.editorConfig.mode);
|
docInfo.put_Mode(this.editorConfig.mode);
|
||||||
|
docInfo.put_ReferenceData(data.doc.referenceData);
|
||||||
|
|
||||||
var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default
|
var coEditMode = !(this.editorConfig.coEditing && typeof this.editorConfig.coEditing == 'object') ? 'fast' : // fast by default
|
||||||
this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer
|
this.editorConfig.mode === 'view' && this.editorConfig.coEditing.change!==false ? 'fast' : // if can change mode in viewer - set fast for using live viewer
|
||||||
|
|
Loading…
Reference in a new issue