From 6296783762204841560d79064a4db06605f78132 Mon Sep 17 00:00:00 2001 From: Alexei Koshelev Date: Thu, 13 Oct 2022 16:49:34 +0300 Subject: [PATCH 1/3] [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', From efdefe3eb3360edbbadd9ad095f734454651e066 Mon Sep 17 00:00:00 2001 From: Alexei Koshelev Date: Fri, 14 Oct 2022 15:14:30 +0300 Subject: [PATCH 2/3] [DE] Update tooltip for combine button --- apps/common/main/lib/controller/ReviewChanges.js | 4 ++-- apps/common/main/lib/view/ReviewChanges.js | 2 +- apps/documenteditor/main/locale/en.json | 2 ++ apps/documenteditor/main/locale/ru.json | 2 ++ 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index 038044699..6633e092a 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -723,9 +723,9 @@ define([ } } })).show(); - } - Common.NotificationCenter.trigger('edit:complete', this.view); + } } + Common.NotificationCenter.trigger('edit:complete', this.view); }, setRevisedFile: function(data) { diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index c1b479fab..b1b6eba75 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -945,7 +945,7 @@ define([ txtCompare: 'Compare', tipCompare: 'Compare current document with another one', txtCombine: 'Combine', - tipCombine: 'Combine', + tipCombine: 'Combine current document with another one', mniFromFile: 'Document from File', mniFromUrl: 'Document from URL', mniFromStorage: 'Document from Storage', diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 587e01b49..bc8798795 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -388,6 +388,7 @@ "Common.Views.ReviewChanges.tipCommentResolve": "Resolve comments", "Common.Views.ReviewChanges.tipCommentResolveCurrent": "Resolve current comments", "Common.Views.ReviewChanges.tipCompare": "Compare current document with another one", + "Common.Views.ReviewChanges.tipCombine": "Combine current document with another one", "Common.Views.ReviewChanges.tipHistory": "Show version history", "Common.Views.ReviewChanges.tipRejectCurrent": "Reject current change", "Common.Views.ReviewChanges.tipReview": "Track changes", @@ -413,6 +414,7 @@ "Common.Views.ReviewChanges.txtCommentResolveMy": "Resolve My Comments", "Common.Views.ReviewChanges.txtCommentResolveMyCurrent": "Resolve My Current Comments", "Common.Views.ReviewChanges.txtCompare": "Compare", + "Common.Views.ReviewChanges.txtCombine": "Combine", "Common.Views.ReviewChanges.txtDocLang": "Language", "Common.Views.ReviewChanges.txtEditing": "Editing", "Common.Views.ReviewChanges.txtFinal": "All changes accepted {0}", diff --git a/apps/documenteditor/main/locale/ru.json b/apps/documenteditor/main/locale/ru.json index 1bf01c6ab..661f63c6b 100644 --- a/apps/documenteditor/main/locale/ru.json +++ b/apps/documenteditor/main/locale/ru.json @@ -388,6 +388,7 @@ "Common.Views.ReviewChanges.tipCommentResolve": "Решить комментарии", "Common.Views.ReviewChanges.tipCommentResolveCurrent": "Решить текущие комментарии", "Common.Views.ReviewChanges.tipCompare": "Сравнить текущий документ с другим", + "Common.Views.ReviewChanges.tipCombine": "Объединить текущий документ с другим", "Common.Views.ReviewChanges.tipHistory": "Показать историю версий", "Common.Views.ReviewChanges.tipRejectCurrent": "Отклонить текущее изменение", "Common.Views.ReviewChanges.tipReview": "Отслеживать изменения", @@ -413,6 +414,7 @@ "Common.Views.ReviewChanges.txtCommentResolveMy": "Решить мои комментарии", "Common.Views.ReviewChanges.txtCommentResolveMyCurrent": "Решить мои текущие комментарии", "Common.Views.ReviewChanges.txtCompare": "Сравнить", + "Common.Views.ReviewChanges.txtCombine": "Объединить", "Common.Views.ReviewChanges.txtDocLang": "Язык", "Common.Views.ReviewChanges.txtEditing": "Редактирование", "Common.Views.ReviewChanges.txtFinal": "Все изменения приняты {0}", From 4d4f04f197f234f3adbc8bef5e3dbf4e5b0b6428 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 22 Dec 2022 13:30:16 +0300 Subject: [PATCH 3/3] [DE] Fix lock combine button --- apps/common/main/lib/controller/ReviewChanges.js | 2 +- apps/common/main/lib/view/ReviewChanges.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index c60b8a9f9..a4bb4ade9 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -1045,7 +1045,7 @@ define([ if (!item.asc_getView()) length++; }); - Common.Utils.lockControls(Common.enumLock.hasCoeditingUsers, length>1, {array: [this.view.btnCompare]}); + Common.Utils.lockControls(Common.enumLock.hasCoeditingUsers, length>1, {array: [this.view.btnCompare, this.view.btnCombine]}); } }, diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index ab8445a84..35378dd16 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -310,7 +310,7 @@ define([ caption: this.txtCombine, split: true, iconCls: 'toolbar__icon combine', - lock: [_set.hasCoeditingUsers, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect], + lock: [_set.hasCoeditingUsers, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.docLockView, _set.docLockForms, _set.docLockComments], dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'small'