From 0d1549e56fd5adac163846599828f2585156d390 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 21 Jan 2022 00:11:12 +0300 Subject: [PATCH] [DE][DE mobile] Support review changes for selection --- .../main/lib/controller/ReviewChanges.js | 10 +-- .../lib/controller/collaboration/Review.jsx | 2 +- .../main/app/view/DocumentHolder.js | 76 ++++++++++++++++++- apps/documenteditor/main/locale/en.json | 2 + .../mobile/src/controller/ContextMenu.jsx | 4 +- 5 files changed, 83 insertions(+), 11 deletions(-) diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index b931d77b9..89af9cccb 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -179,10 +179,10 @@ define([ }); }, - isSelectedChangesLocked: function(changes, fromSelection) { + isSelectedChangesLocked: function(changes, isShow) { if (!changes || changes.length<1) return true; - if (!fromSelection) + if (isShow) return changes[0].get('lock') || !changes[0].get('editable'); for (var i=0; i0) { changes = this.readSDKChange(sdkchange); - btnlock = this.isSelectedChangesLocked(changes, fromSelection); + btnlock = this.isSelectedChangesLocked(changes, isShow); } if (this._state.lock !== btnlock) { this.view.btnAccept.setDisabled(btnlock); @@ -214,7 +214,7 @@ define([ } if (this.getPopover()) { - if (!this.appConfig.reviewHoverMode && sdkchange && sdkchange.length>0 && !fromSelection) { // show changes balloon only for current position, not selection + if (!this.appConfig.reviewHoverMode && sdkchange && sdkchange.length>0 && isShow) { // show changes balloon only for current position, not selection var i = 0, posX = sdkchange[0].get_X(), posY = sdkchange[0].get_Y(), diff --git a/apps/common/mobile/lib/controller/collaboration/Review.jsx b/apps/common/mobile/lib/controller/collaboration/Review.jsx index c9a0e0d76..3fe87e560 100644 --- a/apps/common/mobile/lib/controller/collaboration/Review.jsx +++ b/apps/common/mobile/lib/controller/collaboration/Review.jsx @@ -52,7 +52,7 @@ class InitReview extends Component { }); } - onChangeReview (data) { + onChangeReview (data, isShow) { const storeReview = this.props.storeReview; storeReview.changeArrReview(data); } diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 79bd02b9c..3eaedf043 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -1895,6 +1895,16 @@ define([ me.fireEvent('editcomplete', me); }, + onAcceptRejectChange: function(item, e) { + if (this.api) { + if (item.value == 'accept') + this.api.asc_AcceptChanges(); + else if (item.value == 'reject') + this.api.asc_RejectChanges(); + } + this.fireEvent('editcomplete', this); + }, + onPrintSelection: function(item){ if (this.api){ var printopt = new Asc.asc_CAdjustPrint(); @@ -2516,6 +2526,20 @@ define([ value : 'cut' }).on('click', _.bind(me.onCutCopyPaste, me)); + var menuImgAccept = new Common.UI.MenuItem({ + caption : me.textAccept, + value : 'accept' + }).on('click', _.bind(me.onAcceptRejectChange, me)); + + var menuImgReject = new Common.UI.MenuItem({ + caption : me.textReject, + value : 'reject' + }).on('click', _.bind(me.onAcceptRejectChange, me)); + + var menuImgReviewSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + var menuImgPrint = new Common.UI.MenuItem({ iconCls: 'menu__icon btn-print', caption : me.txtPrintSelection @@ -2745,6 +2769,11 @@ define([ menuImgPrint.setVisible(me.mode.canPrint); menuImgPrint.setDisabled(!cancopy); + var lockreview = Common.Utils.InternalSettings.get("de-accept-reject-lock"); + menuImgAccept.setVisible(!lockreview); + menuImgReject.setVisible(!lockreview); + menuImgReviewSeparator.setVisible(!lockreview); + var signGuid = (value.imgProps && value.imgProps.value && me.mode.isSignatureSupport) ? value.imgProps.value.asc_getSignatureId() : undefined, isInSign = !!signGuid; menuSignatureEditSign.setVisible(isInSign); @@ -2767,6 +2796,9 @@ define([ menuImgPaste, menuImgPrint, { caption: '--' }, + menuImgAccept, + menuImgReject, + menuImgReviewSeparator, menuSignatureEditSign, menuSignatureEditSetup, menuEditSignSeparator, @@ -3081,6 +3113,20 @@ define([ value : 'cut' }).on('click', _.bind(me.onCutCopyPaste, me)); + var menuTableAccept = new Common.UI.MenuItem({ + caption : me.textAccept, + value : 'accept' + }).on('click', _.bind(me.onAcceptRejectChange, me)); + + var menuTableReject = new Common.UI.MenuItem({ + caption : me.textReject, + value : 'reject' + }).on('click', _.bind(me.onAcceptRejectChange, me)); + + var menuTableReviewSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + var menuTablePrint = new Common.UI.MenuItem({ iconCls: 'menu__icon btn-print', caption : me.txtPrintSelection @@ -3787,6 +3833,20 @@ define([ value : 'cut' }).on('click', _.bind(me.onCutCopyPaste, me)); + var menuParaAccept = new Common.UI.MenuItem({ + caption : me.textAccept, + value : 'accept' + }).on('click', _.bind(me.onAcceptRejectChange, me)); + + var menuParaReject = new Common.UI.MenuItem({ + caption : me.textReject, + value : 'reject' + }).on('click', _.bind(me.onAcceptRejectChange, me)); + + var menuParaReviewSeparator = new Common.UI.MenuItem({ + caption : '--' + }); + var menuParaPrint = new Common.UI.MenuItem({ iconCls: 'menu__icon btn-print', caption : me.txtPrintSelection @@ -3985,6 +4045,11 @@ define([ menuParaPrint.setVisible(me.mode.canPrint); menuParaPrint.setDisabled(!cancopy); + var lockreview = Common.Utils.InternalSettings.get("de-accept-reject-lock"); + menuParaAccept.setVisible(!lockreview); + menuParaReject.setVisible(!lockreview); + menuParaReviewSeparator.setVisible(!lockreview); + // spellCheck var spell = (value.spellProps!==undefined && value.spellProps.value.get_Checked()===false); me.menuSpellPara.setVisible(spell); @@ -4011,9 +4076,9 @@ define([ //equation menu var eqlen = 0; if (isEquation) { - eqlen = me.addEquationMenu(true, 15); + eqlen = me.addEquationMenu(true, 18); } else - me.clearEquationMenu(true, 15); + me.clearEquationMenu(true, 18); menuEquationSeparator.setVisible(isEquation && eqlen>0); menuEquationInsertCaption.setVisible(isEquation); menuEquationInsertCaptionSeparator.setVisible(isEquation); @@ -4098,6 +4163,9 @@ define([ menuParaCopy, menuParaPaste, menuParaPrint, + menuParaReviewSeparator, + menuParaAccept, + menuParaReject, menuEquationInsertCaptionSeparator, menuEquationInsertCaption, { caption: '--' }, @@ -4743,7 +4811,9 @@ define([ txtRemoveWarning: 'Do you want to remove this signature?
It can\'t be undone.', notcriticalErrorTitle: 'Warning', txtWarnUrl: 'Clicking this link can be harmful to your device and data.
Are you sure you want to continue?', - textEditPoints: 'Edit Points' + textEditPoints: 'Edit Points', + textAccept: 'Accept Change', + textReject: 'Reject Change' }, DE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 08ed681e8..3b3c18f7a 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -1629,6 +1629,8 @@ "DE.Views.DocumentHolder.txtWarnUrl": "Clicking this link can be harmful to your device and data.
Are you sure you want to continue?", "DE.Views.DocumentHolder.updateStyleText": "Update %1 style", "DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", + "DE.Views.DocumentHolder.textAccept": "Accept Change", + "DE.Views.DocumentHolder.textReject": "Reject Change", "DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill", "DE.Views.DropcapSettingsAdvanced.strDropcap": "Drop Cap", "DE.Views.DropcapSettingsAdvanced.strMargins": "Margins", diff --git a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx index 45906ad60..5c626e228 100644 --- a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx @@ -63,8 +63,8 @@ class ContextMenu extends ContextMenuController { this.isComments = false; } - onApiShowChange(sdkchange) { - this.inRevisionChange = sdkchange && sdkchange.length>0; + onApiShowChange(sdkchange, isShow) { + this.inRevisionChange = isShow && sdkchange && sdkchange.length>0; } // onMenuClosed() {