From 7dfb96f914877b00daba92073cf26c5d2bfdd71d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 4 Aug 2021 13:19:19 +0300 Subject: [PATCH] [DE] Add simple markup mode for display review changes --- apps/api/documents/api.js | 2 +- .../main/lib/controller/ReviewChanges.js | 25 +++++++++----- apps/common/main/lib/view/ReviewChanges.js | 18 ++++++++-- .../lib/controller/collaboration/Review.jsx | 34 +++++++++---------- apps/documenteditor/main/locale/en.json | 2 ++ 5 files changed, 51 insertions(+), 30 deletions(-) diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index 2aa7ad002..55d5e7bc1 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -155,7 +155,7 @@ compactHeader: false, toolbarNoTabs: false, toolbarHideFileName: false, - reviewDisplay: 'original', + reviewDisplay: 'original', // original for viewer, markup for editor spellcheck: true, compatibleFeatures: false, unit: 'cm' // cm, pt, inch, diff --git a/apps/common/main/lib/controller/ReviewChanges.js b/apps/common/main/lib/controller/ReviewChanges.js index b9c7ac6b2..549ed477f 100644 --- a/apps/common/main/lib/controller/ReviewChanges.js +++ b/apps/common/main/lib/controller/ReviewChanges.js @@ -595,7 +595,10 @@ define([ onReviewViewClick: function(menu, item, e) { this.turnDisplayMode(item.value); - !this.appConfig.canReview && Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value); + if (!this.appConfig.isEdit && !this.appConfig.isRestrictedEdit) + Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value); // for viewer + else if (item.value=='markup' || item.value=='simple') + Common.localStorage.setItem(this.view.appPrefix + "review-mode-editor", item.value); // for editor save only markup modes Common.NotificationCenter.trigger('edit:complete', this.view); }, @@ -690,7 +693,7 @@ define([ else if (mode === 'original') this.api.asc_BeginViewModeInReview(false); else - this.api.asc_EndViewModeInReview(); + this.api.asc_EndViewModeInReview(mode=='simple'); } this.disableEditing(mode == 'final' || mode == 'original'); this._state.previewMode = (mode == 'final' || mode == 'original'); @@ -702,9 +705,9 @@ define([ this._state.previewMode = true; }, - onEndViewModeInReview: function() { + onEndViewModeInReview: function(mode) { this.disableEditing(false); - this.view && this.view.turnDisplayMode('markup'); + this.view && this.view.turnDisplayMode(mode ? 'simple' : 'markup'); this._state.previewMode = false; }, @@ -804,7 +807,11 @@ define([ me.onApiTrackRevisionsChange(me.api.asc_GetLocalTrackRevisions(), me.api.asc_GetGlobalTrackRevisions()); me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true); - // _setReviewStatus(state, global); + var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode-editor"); + if (val===null) + val = me.appConfig.customization && /^(original|final|markup|simple)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : 'markup'; + me.turnDisplayMode(val); // load display mode for all modes (viewer or editor) + me.view.turnDisplayMode(val); if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) { me.dlgChanges = (new Common.Views.ReviewChangesDialog({ @@ -819,11 +826,11 @@ define([ } else if (config.canViewReview) { config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users if (config.canViewReview) { - var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode"); + var val = Common.localStorage.getItem(me.view.appPrefix + (config.isEdit || config.isRestrictedEdit ? "review-mode-editor" : "review-mode")); if (val===null) - val = me.appConfig.customization && /^(original|final|markup)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : 'original'; - me.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); // load display mode only in viewer - me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); + val = me.appConfig.customization && /^(original|final|markup|simple)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : (config.isEdit || config.isRestrictedEdit ? 'markup' : 'original'); + me.turnDisplayMode(val); + me.view.turnDisplayMode(val); } } diff --git a/apps/common/main/lib/view/ReviewChanges.js b/apps/common/main/lib/view/ReviewChanges.js index 0b52de0d9..d30a0448b 100644 --- a/apps/common/main/lib/view/ReviewChanges.js +++ b/apps/common/main/lib/view/ReviewChanges.js @@ -298,6 +298,15 @@ define([ template: menuTemplate, description: this.txtMarkup }, + { + caption: this.txtMarkupSimpleCap, + checkable: true, + toggleGroup: 'menuReviewView', + checked: false, + value: 'simple', + template: menuTemplate, + description: this.txtMarkupSimple + }, { caption: this.txtFinalCap, checkable: true, @@ -750,8 +759,9 @@ define([ turnDisplayMode: function(mode) { if (this.btnReviewView) { this.btnReviewView.menu.items[0].setChecked(mode=='markup', true); - this.btnReviewView.menu.items[1].setChecked(mode=='final', true); - this.btnReviewView.menu.items[2].setChecked(mode=='original', true); + this.btnReviewView.menu.items[1].setChecked(mode=='simple', true); + this.btnReviewView.menu.items[2].setChecked(mode=='final', true); + this.btnReviewView.menu.items[3].setChecked(mode=='original', true); } }, @@ -850,7 +860,9 @@ define([ txtOff: 'OFF for me', textWarnTrackChangesTitle: 'Enable Track Changes for everyone?', textWarnTrackChanges: 'Track Changes will be switched ON for all users with full access. The next time anyone opens the doc, Track Changes will remain enabled.', - textEnable: 'Enable' + textEnable: 'Enable', + txtMarkupSimpleCap: 'Simple Markup', + txtMarkupSimple: 'All changes (Editing)
Turn off pop-up windows with changes' } }()), Common.Views.ReviewChanges || {})); diff --git a/apps/common/mobile/lib/controller/collaboration/Review.jsx b/apps/common/mobile/lib/controller/collaboration/Review.jsx index 1ffa6780d..507c0d850 100644 --- a/apps/common/mobile/lib/controller/collaboration/Review.jsx +++ b/apps/common/mobile/lib/controller/collaboration/Review.jsx @@ -22,24 +22,24 @@ class InitReview extends Component { api.asc_SetTrackRevisions(appOptions.isReviewOnly || trackChanges===true || (trackChanges!==false) && LocalStorage.getBool("de-mobile-track-changes-" + (appOptions.fileKey || ''))); // Init display mode - if (!appOptions.canReview) { - const canViewReview = appOptions.isEdit || api.asc_HaveRevisionsChanges(true); + + const canViewReview = appOptions.canReview || appOptions.isEdit || api.asc_HaveRevisionsChanges(true); + if (!appOptions.canReview) appOptions.setCanViewReview(canViewReview); - if (canViewReview) { - let viewReviewMode = LocalStorage.getItem("de-view-review-mode"); - if (viewReviewMode === null) - viewReviewMode = appOptions.customization && /^(original|final|markup)$/i.test(appOptions.customization.reviewDisplay) ? appOptions.customization.reviewDisplay.toLocaleLowerCase() : 'original'; - viewReviewMode = (appOptions.isEdit || appOptions.isRestrictedEdit) ? 'markup' : viewReviewMode; - const displayMode = viewReviewMode.toLocaleLowerCase(); - if (displayMode === 'final') { - api.asc_BeginViewModeInReview(true); - } else if (displayMode === 'original') { - api.asc_BeginViewModeInReview(false); - } else { - api.asc_EndViewModeInReview(); - } - props.storeReview.changeDisplayMode(displayMode); + if (canViewReview) { + let viewReviewMode = (appOptions.isEdit || appOptions.isRestrictedEdit) ? null : LocalStorage.getItem("de-view-review-mode"); + if (viewReviewMode === null) + viewReviewMode = appOptions.customization && /^(original|final|markup|simple)$/i.test(appOptions.customization.reviewDisplay) ? appOptions.customization.reviewDisplay.toLocaleLowerCase() : ( appOptions.isEdit || appOptions.isRestrictedEdit ? 'markup' : 'original'); + let displayMode = viewReviewMode.toLocaleLowerCase(); + if (displayMode === 'final') { + api.asc_BeginViewModeInReview(true); + } else if (displayMode === 'original') { + api.asc_BeginViewModeInReview(false); + } else { + (displayMode === 'simple') && (displayMode = 'markup'); + api.asc_EndViewModeInReview(); } + props.storeReview.changeDisplayMode(displayMode); } }); } @@ -102,7 +102,7 @@ class Review extends Component { } else { api.asc_EndViewModeInReview(); } - !this.appConfig.canReview && LocalStorage.setItem("de-view-review-mode", mode); + !this.appConfig.isEdit && !this.appConfig.isRestrictedEdit && LocalStorage.setItem("de-view-review-mode", mode); this.props.storeReview.changeDisplayMode(mode); } diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index 9c33f4a6b..67f742f6d 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -398,6 +398,8 @@ "Common.Views.ReviewChanges.txtSpelling": "Spell Checking", "Common.Views.ReviewChanges.txtTurnon": "Track Changes", "Common.Views.ReviewChanges.txtView": "Display Mode", + "Common.Views.ReviewChanges.txtMarkupSimpleCap": "Simple Markup", + "Common.Views.ReviewChanges.txtMarkupSimple": "All changes (Editing)
Turn off pop-up windows with changes", "Common.Views.ReviewChangesDialog.textTitle": "Review Changes", "Common.Views.ReviewChangesDialog.txtAccept": "Accept", "Common.Views.ReviewChangesDialog.txtAcceptAll": "Accept All Changes",