[DE] Compare documents: use sdk methods

This commit is contained in:
Julia Radzhabova 2019-08-14 16:18:57 +03:00
parent 8ae13a7fde
commit 322888f37d
2 changed files with 14 additions and 10 deletions

View file

@ -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);

View file

@ -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();