[DE] Added button Combine

This commit is contained in:
Alexei Koshelev 2022-10-13 16:49:34 +03:00
parent c03c7638d9
commit 6296783762
2 changed files with 65 additions and 0 deletions

View file

@ -81,6 +81,7 @@ define([
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this),
'reviewchange:view': _.bind(this.onReviewViewClick, this),
'reviewchange:compare': _.bind(this.onCompareClick, this),
'reviewchange:combine': _.bind(this.onCombineClick, this),
'lang:document': _.bind(this.onDocLanguage, this),
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
},
@ -697,6 +698,36 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.view);
},
onCombineClick: 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"));
}
if (item === 'file') {
this.api.asc_MergeDocumentFile(this._state.compareSettings);
Common.NotificationCenter.trigger('edit:complete', this.view);
} else if (item === 'url') {
(new Common.Views.ImageFromUrlDialog({
title: me.textUrl,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) {
me.api.asc_MergeDocumentUrl(checkUrl, me._state.compareSettings);
}
}
Common.NotificationCenter.trigger('edit:complete', me.view);
}
}
})).show();
}
Common.NotificationCenter.trigger('edit:complete', this.view);
}
},
setRevisedFile: function(data) {
if (!this._state.compareSettings) {
this._state.compareSettings = new AscCommonWord.ComparisonOptions();

View file

@ -103,6 +103,7 @@ define([
'<div class="separator long review"></div>' +
'<div class="group">' +
'<span id="btn-compare" class="btn-slot text x-huge"></span>' +
'<span id="btn-combine" class="btn-slot text x-huge"></span>' +
'</div>' +
'<div class="separator long compare"></div>' +
'<div class="group no-group-mask review form-view">' +
@ -142,6 +143,15 @@ define([
this.btnCompare.menu.on('item:click', function (menu, item, e) {
me.fireEvent('reviewchange:compare', [item.value]);
});
this.btnCombine.on('click', function(e) {
me.fireEvent('reviewchange:combine', ['file']);
});
this.btnCombine.menu.on('item:click', function(menu, item, e) {
me.fireEvent('reviewchange:combine', [item.value]);
});
}
this.btnsTurnReview.forEach(function (button) {
@ -290,6 +300,18 @@ define([
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnCompare);
this.btnCombine = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
caption: this.txtCombine,
split: true,
iconCls: 'toolbar__icon combine',
lock: [_set.hasCoeditingUsers, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect],
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnCombine);
}
this.btnTurnOn = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top',
@ -569,6 +591,15 @@ define([
}));
me.btnCompare.menu.items[2].setVisible(me.appConfig.canRequestCompareFile || me.appConfig.fileChoiceUrl && me.appConfig.fileChoiceUrl.indexOf("{documentType}")>-1);
me.btnCompare.updateHint(me.tipCompare);
me.btnCombine.setMenu(new Common.UI.Menu({
items: [
{caption: me.mniFromFile, value: 'file'},
{caption: me.mniFromUrl, value: 'url'},
]
}));
me.btnCombine.updateHint(me.tipCombine);
}
Common.Utils.lockControls(Common.enumLock.isReviewOnly, config.isReviewOnly, {array: [me.btnAccept, me.btnReject]});
@ -705,6 +736,7 @@ define([
this.btnAccept.render(this.$el.find('#btn-change-accept'));
this.btnReject.render(this.$el.find('#btn-change-reject'));
this.appConfig.canFeatureComparison && this.btnCompare.render(this.$el.find('#btn-compare'));
this.appConfig.canFeatureComparison && this.btnCombine.render(this.$el.find('#btn-combine'));
this.btnTurnOn.render(this.$el.find('#btn-review-on'));
}
this.btnPrev && this.btnPrev.render(this.$el.find('#btn-change-prev'));
@ -912,6 +944,8 @@ define([
strStrictDesc: 'Use the \'Save\' button to sync the changes you and others make.',
txtCompare: 'Compare',
tipCompare: 'Compare current document with another one',
txtCombine: 'Combine',
tipCombine: 'Combine',
mniFromFile: 'Document from File',
mniFromUrl: 'Document from URL',
mniFromStorage: 'Document from Storage',