From 322888f37d32df875df95660a08f5891529b2e8c Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 14 Aug 2019 16:18:57 +0300 Subject: [PATCH] [DE] Compare documents: use sdk methods --- apps/common/main/lib/controller/ReviewChanges.js | 10 +++++++--- .../main/app/view/CompareSettingsDialog.js | 14 +++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 3eff2a871d..5eea76e1f5 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -557,9 +557,13 @@ define([ onCompareClick: function(item) { if (this.api) { + if (!this._state.compareSettings) { + this._state.compareSettings = new AscCommonWord.ComparisonOptions(); + this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char")); + } if (item === 'file') { - // if (this.api) - // this.api.asc_addDocument(me._state.compareSettings); + if (this.api) + this.api.asc_CompareDocumentFile(this._state.compareSettings); Common.NotificationCenter.trigger('edit:complete', this.view); } else if (item === 'url') { var me = this; @@ -570,7 +574,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - // me.api.AddDocumentUrl(checkUrl, me._state.compareSettings); + me.api.asc_CompareDocumentUrl(checkUrl, me._state.compareSettings); } } Common.NotificationCenter.trigger('edit:complete', me.view); diff --git a/apps/documenteditor/main/app/view/CompareSettingsDialog.js b/apps/documenteditor/main/app/view/CompareSettingsDialog.js index 20fc1bc1b0..dbf6f5c462 100644 --- a/apps/documenteditor/main/app/view/CompareSettingsDialog.js +++ b/apps/documenteditor/main/app/view/CompareSettingsDialog.js @@ -107,8 +107,7 @@ define([ this.radioWord = new Common.UI.RadioBox({ el: $('#compare-settings-radio-word'), labelText: this.textWord, - name: 'asc-radio-compare-show', - checked: true + name: 'asc-radio-compare-show' }); this.afterRender(); @@ -124,15 +123,15 @@ define([ _setDefaults: function (props) { if (props) { - // var val = props.get_ShowAt(); - // val ? this.radioChar.setValue(true, true) : this.radioWord.setValue(true, true); + var value = props.getWords(); + (value==false) ? this.radioChar.setValue(true, true) : this.radioWord.setValue(true, true); } }, getSettings: function () { - // var props = new AscCommon.CComparisonPr(); - // props.put_ShowAt(this.radioChar.getValue()); - // return props; + var props = new AscCommonWord.ComparisonOptions(); + props.putWords(this.radioWord.getValue()); + return props; }, onDlgBtnClick: function(event) { @@ -140,6 +139,7 @@ define([ var state = (typeof(event) == 'object') ? event.currentTarget.attributes['result'].value : event; if (state == 'ok') { this.handler && this.handler.call(this, state, this.getSettings()); + Common.localStorage.setItem("de-compare-char", this.radioChar.getValue()); } this.close();