From e605452cfb34b615342d33531d024ec8af71b88e Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 15 Oct 2019 11:44:38 +0300 Subject: [PATCH] [DE] Compare use onRequestCompareFile/setRevisedFile for loading file --- apps/api/documents/api.js | 10 +++++++++- apps/common/Gateway.js | 4 ++-- .../main/lib/controller/ReviewChanges.js | 18 ++++++++---------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 5782fb9f7..e46df27fd 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -576,6 +576,13 @@ }); }; + var _setRevisedFile = function(data) { + _sendCommand({ + command: 'setRevisedFile', + data: data + }); + }; + var _processMouse = function(evt) { var r = iframe.getBoundingClientRect(); var data = { @@ -620,7 +627,8 @@ showSharingSettings : _showSharingSettings, setSharingSettings : _setSharingSettings, insertImage : _insertImage, - setMailMergeRecipients: _setMailMergeRecipients + setMailMergeRecipients: _setMailMergeRecipients, + setRevisedFile : _setRevisedFile } }; diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index b8726a329..6d45aa3a7 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -120,8 +120,8 @@ if (Common === undefined) { $me.trigger('setmailmergerecipients', data); }, - 'compareFile': function(data) { - $me.trigger('comparefile', data); + 'setRevisedFile': function(data) { + $me.trigger('setrevisedfile', data); } }; diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index b06d4be0a..2b0415dcf 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -128,7 +128,7 @@ define([ this.api.asc_registerCallback('asc_onAcceptChangesBeforeCompare',_.bind(this.onAcceptChangesBeforeCompare, 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) { if (this.api) { + var me = this; if (!this._state.compareSettings) { this._state.compareSettings = new AscCommonWord.ComparisonOptions(); this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char")); @@ -579,7 +580,6 @@ define([ this.api.asc_CompareDocumentFile(this._state.compareSettings); Common.NotificationCenter.trigger('edit:complete', this.view); } else if (item === 'url') { - var me = this; (new Common.Views.ImageFromUrlDialog({ title: me.textUrl, handler: function(result, value) { @@ -595,18 +595,16 @@ define([ } })).show(); } else if (item === 'storage') { - var me = this; - // if (this.appConfig.canRequestCompareFile) { - // Common.Gateway.requestCompareFile(); - // } else { + if (this.appConfig.canRequestCompareFile) { + Common.Gateway.requestCompareFile(); + } else { (new Common.Views.SelectFileDlg({ fileChoiceUrl: this.appConfig.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "DocumentsOnly") })).on('selectfile', function(obj, file){ - me.compareFile(file, me._state.compareSettings); + me.setRevisedFile(file, me._state.compareSettings); }).show(); - // } + } } else if (item === 'settings') { - var me = this; (new DE.Views.CompareSettingsDialog({ props: me._state.compareSettings, handler: function(result, value) { @@ -622,7 +620,7 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.view); }, - compareFile: function(data) { + setRevisedFile: function(data) { if (!this._state.compareSettings) { this._state.compareSettings = new AscCommonWord.ComparisonOptions(); this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));