[DE] Compare use onRequestCompareFile/setRevisedFile for loading file

This commit is contained in:
Julia Radzhabova 2019-10-15 11:44:38 +03:00
parent 3facb70eba
commit e605452cfb
3 changed files with 19 additions and 13 deletions

View file

@ -576,6 +576,13 @@
}); });
}; };
var _setRevisedFile = function(data) {
_sendCommand({
command: 'setRevisedFile',
data: data
});
};
var _processMouse = function(evt) { var _processMouse = function(evt) {
var r = iframe.getBoundingClientRect(); var r = iframe.getBoundingClientRect();
var data = { var data = {
@ -620,7 +627,8 @@
showSharingSettings : _showSharingSettings, showSharingSettings : _showSharingSettings,
setSharingSettings : _setSharingSettings, setSharingSettings : _setSharingSettings,
insertImage : _insertImage, insertImage : _insertImage,
setMailMergeRecipients: _setMailMergeRecipients setMailMergeRecipients: _setMailMergeRecipients,
setRevisedFile : _setRevisedFile
} }
}; };

View file

@ -120,8 +120,8 @@ if (Common === undefined) {
$me.trigger('setmailmergerecipients', data); $me.trigger('setmailmergerecipients', data);
}, },
'compareFile': function(data) { 'setRevisedFile': function(data) {
$me.trigger('comparefile', data); $me.trigger('setrevisedfile', data);
} }
}; };

View file

@ -128,7 +128,7 @@ define([
this.api.asc_registerCallback('asc_onAcceptChangesBeforeCompare',_.bind(this.onAcceptChangesBeforeCompare, this)); this.api.asc_registerCallback('asc_onAcceptChangesBeforeCompare',_.bind(this.onAcceptChangesBeforeCompare, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
Common.Gateway.on('comparefile', _.bind(this.compareFile, this)); Common.Gateway.on('setrevisedfile', _.bind(this.setRevisedFile, this));
} }
}, },
@ -570,6 +570,7 @@ define([
onCompareClick: function(item) { onCompareClick: function(item) {
if (this.api) { if (this.api) {
var me = this;
if (!this._state.compareSettings) { if (!this._state.compareSettings) {
this._state.compareSettings = new AscCommonWord.ComparisonOptions(); this._state.compareSettings = new AscCommonWord.ComparisonOptions();
this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char")); this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));
@ -579,7 +580,6 @@ define([
this.api.asc_CompareDocumentFile(this._state.compareSettings); this.api.asc_CompareDocumentFile(this._state.compareSettings);
Common.NotificationCenter.trigger('edit:complete', this.view); Common.NotificationCenter.trigger('edit:complete', this.view);
} else if (item === 'url') { } else if (item === 'url') {
var me = this;
(new Common.Views.ImageFromUrlDialog({ (new Common.Views.ImageFromUrlDialog({
title: me.textUrl, title: me.textUrl,
handler: function(result, value) { handler: function(result, value) {
@ -595,18 +595,16 @@ define([
} }
})).show(); })).show();
} else if (item === 'storage') { } else if (item === 'storage') {
var me = this; if (this.appConfig.canRequestCompareFile) {
// if (this.appConfig.canRequestCompareFile) { Common.Gateway.requestCompareFile();
// Common.Gateway.requestCompareFile(); } else {
// } else {
(new Common.Views.SelectFileDlg({ (new Common.Views.SelectFileDlg({
fileChoiceUrl: this.appConfig.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "DocumentsOnly") fileChoiceUrl: this.appConfig.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "DocumentsOnly")
})).on('selectfile', function(obj, file){ })).on('selectfile', function(obj, file){
me.compareFile(file, me._state.compareSettings); me.setRevisedFile(file, me._state.compareSettings);
}).show(); }).show();
// } }
} else if (item === 'settings') { } else if (item === 'settings') {
var me = this;
(new DE.Views.CompareSettingsDialog({ (new DE.Views.CompareSettingsDialog({
props: me._state.compareSettings, props: me._state.compareSettings,
handler: function(result, value) { handler: function(result, value) {
@ -622,7 +620,7 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.view); Common.NotificationCenter.trigger('edit:complete', this.view);
}, },
compareFile: function(data) { setRevisedFile: function(data) {
if (!this._state.compareSettings) { if (!this._state.compareSettings) {
this._state.compareSettings = new AscCommonWord.ComparisonOptions(); this._state.compareSettings = new AscCommonWord.ComparisonOptions();
this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char")); this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));