From 9b31aee15b81f539195811cd072afcaa784ad53a Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Tue, 3 Aug 2021 18:14:45 +0300 Subject: [PATCH] [DE mobile] Fix Bug 51670 --- .../src => common/mobile/lib}/store/review.js | 46 +++++++++---------- .../lib/view/collaboration/Comments.jsx | 30 +++++++----- .../mobile/src/store/mainStore.js | 2 +- .../mobile/src/store/mainStore.js | 2 + .../mobile/src/store/mainStore.js | 2 + 5 files changed, 47 insertions(+), 35 deletions(-) rename apps/{documenteditor/mobile/src => common/mobile/lib}/store/review.js (95%) diff --git a/apps/documenteditor/mobile/src/store/review.js b/apps/common/mobile/lib/store/review.js similarity index 95% rename from apps/documenteditor/mobile/src/store/review.js rename to apps/common/mobile/lib/store/review.js index 61c39e384..0049a7319 100644 --- a/apps/documenteditor/mobile/src/store/review.js +++ b/apps/common/mobile/lib/store/review.js @@ -1,24 +1,24 @@ -import {action, observable, makeObservable} from 'mobx'; - -export class storeReview { - constructor() { - makeObservable(this, { - displayMode: observable, - dataChanges: observable, - changeDisplayMode: action, - changeArrReview: action - }); - } - - displayMode = 'markup'; - - changeDisplayMode (mode) { - this.displayMode = mode; - } - - dataChanges = []; - - changeArrReview (data) { - this.dataChanges = data && data.length > 0 ? data : []; - } +import {action, observable, makeObservable} from 'mobx'; + +export class storeReview { + constructor() { + makeObservable(this, { + displayMode: observable, + dataChanges: observable, + changeDisplayMode: action, + changeArrReview: action + }); + } + + displayMode = 'markup'; + + changeDisplayMode (mode) { + this.displayMode = mode; + } + + dataChanges = []; + + changeArrReview (data) { + this.dataChanges = data && data.length > 0 ? data : []; + } } \ No newline at end of file diff --git a/apps/common/mobile/lib/view/collaboration/Comments.jsx b/apps/common/mobile/lib/view/collaboration/Comments.jsx index 381ed375f..5917ba4be 100644 --- a/apps/common/mobile/lib/view/collaboration/Comments.jsx +++ b/apps/common/mobile/lib/view/collaboration/Comments.jsx @@ -628,10 +628,11 @@ const pickLink = (message) => { } // View comments -const ViewComments = ({storeComments, storeAppOptions, onCommentMenuClick, onResolveComment, showComment}) => { +const ViewComments = ({storeComments, storeAppOptions, onCommentMenuClick, onResolveComment, showComment, storeReview}) => { const { t } = useTranslation(); const _t = t('Common.Collaboration', {returnObjects: true}); const isAndroid = Device.android; + const displayMode = storeReview.displayMode; const viewMode = !storeAppOptions.canComments; const comments = storeComments.groupCollectionFilter || storeComments.collectionComments; @@ -672,10 +673,13 @@ const ViewComments = ({storeComments, storeAppOptions, onCommentMenuClick, onRes {!viewMode &&
- {comment.editable &&
{onResolveComment(comment);}}>
} -
{setComment(comment); openActionComment(true);}} - >
+ {(comment.editable && displayMode === 'markup') &&
{onResolveComment(comment);}}>
} + {displayMode === 'markup' && +
{setComment(comment); openActionComment(true);}}> + +
+ }
} @@ -734,13 +738,14 @@ const ViewComments = ({storeComments, storeAppOptions, onCommentMenuClick, onRes ) }; -const _ViewComments = inject('storeComments', 'storeAppOptions')(observer(ViewComments)); +const _ViewComments = inject('storeComments', 'storeAppOptions', "storeReview")(observer(ViewComments)); -const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeComments, storeAppOptions, onCommentMenuClick, onResolveComment}) => { +const CommentList = inject("storeComments", "storeAppOptions", "storeReview")(observer(({storeComments, storeAppOptions, onCommentMenuClick, onResolveComment, storeReview}) => { const { t } = useTranslation(); const _t = t('Common.Collaboration', {returnObjects: true}); const isAndroid = Device.android; + const displayMode = storeReview.displayMode; const viewMode = !storeAppOptions.canComments; const comments = storeComments.showComments; @@ -801,10 +806,13 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC {!viewMode &&
- {comment.editable &&
{onResolveComment(comment);}}>
} -
{openActionComment(true);}} - >
+ {(comment.editable && displayMode === 'markup') &&
{onResolveComment(comment);}}>
} + {displayMode === 'markup' && +
{openActionComment(true);}}> + +
+ }
} diff --git a/apps/documenteditor/mobile/src/store/mainStore.js b/apps/documenteditor/mobile/src/store/mainStore.js index d145ad369..1c1d2cc29 100644 --- a/apps/documenteditor/mobile/src/store/mainStore.js +++ b/apps/documenteditor/mobile/src/store/mainStore.js @@ -13,7 +13,7 @@ import {storeLinkSettings} from './linkSettings'; import {storeApplicationSettings} from './applicationSettings'; import {storeAppOptions} from "./appOptions"; import {storePalette} from "./palette"; -import {storeReview} from "./review"; +import {storeReview} from '../../../../common/mobile/lib/store/review'; import {storeComments} from "../../../../common/mobile/lib/store/comments"; import {storeToolbarSettings} from "./toolbar"; diff --git a/apps/presentationeditor/mobile/src/store/mainStore.js b/apps/presentationeditor/mobile/src/store/mainStore.js index a750c72fb..586e7a83e 100644 --- a/apps/presentationeditor/mobile/src/store/mainStore.js +++ b/apps/presentationeditor/mobile/src/store/mainStore.js @@ -16,6 +16,7 @@ import { storeLinkSettings } from "./linkSettings"; // import {storeParagraphSettings} from "./paragraphSettings"; // import {storeShapeSettings} from "./shapeSettings"; // import {storeImageSettings} from "./imageSettings"; +import {storeReview} from '../../../../common/mobile/lib/store/review'; import {storeComments} from "../../../../common/mobile/lib/store/comments"; import {storeToolbarSettings} from "./toolbar"; @@ -34,6 +35,7 @@ export const stores = { storeTableSettings: new storeTableSettings(), storeChartSettings: new storeChartSettings(), storeLinkSettings: new storeLinkSettings(), + storeReview: new storeReview(), // storeTextSettings: new storeTextSettings(), // storeParagraphSettings: new storeParagraphSettings(), // storeShapeSettings: new storeShapeSettings(), diff --git a/apps/spreadsheeteditor/mobile/src/store/mainStore.js b/apps/spreadsheeteditor/mobile/src/store/mainStore.js index de8a2c11e..93742a6c4 100644 --- a/apps/spreadsheeteditor/mobile/src/store/mainStore.js +++ b/apps/spreadsheeteditor/mobile/src/store/mainStore.js @@ -15,6 +15,7 @@ import {storeAppOptions} from "./appOptions"; // import {storeTableSettings} from "./tableSettings"; import {storeChartSettings} from "./chartSettings"; import {storeSpreadsheetSettings} from "./spreadsheetSettings"; +import {storeReview} from '../../../../common/mobile/lib/store/review'; import {storeComments} from "../../../../common/mobile/lib/store/comments"; import {storeToolbarSettings} from "./toolbar"; @@ -33,6 +34,7 @@ export const stores = { storeChartSettings: new storeChartSettings(), storePalette: new storePalette(), storeCellSettings: new storeCellSettings(), + storeReview: new storeReview(), // storeImageSettings: new storeImageSettings(), // storeTableSettings: new storeTableSettings() storeComments: new storeComments(),