From 6296783762204841560d79064a4db06605f78132 Mon Sep 17 00:00:00 2001 From: Alexei Koshelev Date: Thu, 13 Oct 2022 16:49:34 +0300 Subject: [PATCH] [DE] Added button Combine --- .../main/lib/controller/ReviewChanges.js | 31 +++++++++++++++++ apps/common/main/lib/view/ReviewChanges.js | 34 +++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 9cd921188..038044699 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -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(); diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index baba01435..c1b479fab 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -103,6 +103,7 @@ define([ '
' + '
' + '' + + '' + '
' + '
' + '
' + @@ -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',