diff --git a/apps/common/mobile/lib/controller/collaboration/Collaboration.jsx b/apps/common/mobile/lib/controller/collaboration/Collaboration.jsx index a1dbec1b2..a72809b9b 100644 --- a/apps/common/mobile/lib/controller/collaboration/Collaboration.jsx +++ b/apps/common/mobile/lib/controller/collaboration/Collaboration.jsx @@ -6,8 +6,7 @@ class CollaborationController extends Component { constructor(props){ super(props); - Common.Notifications.on('configOptionsFill', () => { - const api = Common.EditorApi.get(); + Common.Notifications.on('engineCreated', (api) => { api.asc_registerCallback('asc_onAuthParticipantsChanged', this.onChangeEditUsers.bind(this)); api.asc_registerCallback('asc_onParticipantsChanged', this.onChangeEditUsers.bind(this)); api.asc_registerCallback('asc_onConnectionStateChanged', this.onUserConnection.bind(this)); diff --git a/apps/common/mobile/lib/controller/collaboration/Comments.jsx b/apps/common/mobile/lib/controller/collaboration/Comments.jsx index d7204f010..c0d087e62 100644 --- a/apps/common/mobile/lib/controller/collaboration/Comments.jsx +++ b/apps/common/mobile/lib/controller/collaboration/Comments.jsx @@ -238,6 +238,9 @@ class AddCommentController extends Component { } getUserInfo () { this.currentUser = this.props.users.currentUser; + if (!this.currentUser) { + this.currentUser = this.props.users.setCurrentUser(this.props.storeAppOptions.user.id); + } const name = this.currentUser.asc_getUserName(); return { name: name, diff --git a/apps/common/mobile/lib/store/users.js b/apps/common/mobile/lib/store/users.js index 57a7f5a06..bf334c8e2 100644 --- a/apps/common/mobile/lib/store/users.js +++ b/apps/common/mobile/lib/store/users.js @@ -28,6 +28,7 @@ export class storeUsers { this.currentUser = item; } }); + return this.currentUser; } connection (change) { diff --git a/apps/presentationeditor/mobile/locale/en.json b/apps/presentationeditor/mobile/locale/en.json index 15ec8dca9..dc57ad180 100644 --- a/apps/presentationeditor/mobile/locale/en.json +++ b/apps/presentationeditor/mobile/locale/en.json @@ -267,6 +267,27 @@ "textThemeColors": "Theme Colors", "textStandartColors": "Standard Colors", "textCustomColors": "Custom Colors" + }, + "Collaboration": { + "textCollaboration": "Collaboration", + "textBack": "Back", + "textUsers": "Users", + "textEditUser": "Users who are editing the file:", + "textComments": "Comments", + "textAddComment": "Add Comment", + "textCancel": "Cancel", + "textDone": "Done", + "textNoComments": "This document doesn't contain comments", + "textEdit": "Edit", + "textResolve": "Resolve", + "textReopen": "Reopen", + "textAddReply": "Add Reply", + "textDeleteComment": "Delete Comment", + "textMessageDeleteComment": "Do you really want to delete this comment?", + "textMessageDeleteReply": "Do you really want to delete this reply?", + "textDeleteReply": "Delete Reply", + "textEditComment": "Edit Comment", + "textEditReply": "Edit Reply" } } } \ No newline at end of file diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index d8ee673da..76f2f65ce 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -1,9 +1,15 @@ -import React, { Component } from 'react' +import React, { Component, Fragment } from 'react' import { inject } from "mobx-react"; import { f7 } from "framework7-react"; import { withTranslation } from 'react-i18next'; -import CollaborationController from '../../../../common/mobile/lib/controller/collaboration/Collaboration.jsx' +import CollaborationController from '../../../../common/mobile/lib/controller/collaboration/Collaboration.jsx'; +import { + CommentsController, + AddCommentController, + EditCommentController, + ViewCommentsController +} from "../../../../common/mobile/lib/controller/collaboration/Comments"; @inject("storeFocusObjects", "storeAppOptions", "storePresentationInfo", "storePresentationSettings", "storeSlideSettings", "storeTextSettings", "storeTableSettings", "storeChartSettings", "storeLinkSettings") class MainController extends Component { @@ -346,7 +352,15 @@ class MainController extends Component { } render() { - return + return ( + + + + + + + + ) } componentDidMount() { diff --git a/apps/presentationeditor/mobile/src/controller/add/AddOther.jsx b/apps/presentationeditor/mobile/src/controller/add/AddOther.jsx index e2838493e..4ac82cca4 100644 --- a/apps/presentationeditor/mobile/src/controller/add/AddOther.jsx +++ b/apps/presentationeditor/mobile/src/controller/add/AddOther.jsx @@ -88,10 +88,38 @@ class AddOtherController extends Component { }); } + hideAddComment () { + const api = Common.EditorApi.get(); + const stack = api.getSelectedElements(); + let isText = false, + isChart = false; + + stack.forEach((item) => { + const objectType = item.get_ObjectType(); + if (objectType === Asc.c_oAscTypeSelectElement.Paragraph) { + isText = true; + } else if (objectType === Asc.c_oAscTypeSelectElement.Chart) { + isChart = true; + } + }); + if (stack.length > 0) { + const topObject = stack[stack.length - 1]; + const topObjectValue = topObject.get_ObjectValue(); + let objectLocked = typeof topObjectValue.get_Locked === 'function' ? topObjectValue.get_Locked() : false; + !objectLocked && (objectLocked = typeof topObjectValue.get_LockDelete === 'function' ? topObjectValue.get_LockDelete() : false); + if (!objectLocked) { + return ((isText && isChart) || api.can_AddQuotedComment() === false); + } + } + return true; + } + render () { return ( - ) } diff --git a/apps/presentationeditor/mobile/src/store/mainStore.js b/apps/presentationeditor/mobile/src/store/mainStore.js index 4ed3fd33e..299a6a63b 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 {storeComments} from "../../../../common/mobile/lib/store/comments"; export const stores = { storeAppOptions: new storeAppOptions(), @@ -31,10 +32,11 @@ export const stores = { storeShapeSettings: new storeShapeSettings(), storeTableSettings: new storeTableSettings(), storeChartSettings: new storeChartSettings(), - storeLinkSettings: new storeLinkSettings() + storeLinkSettings: new storeLinkSettings(), // storeTextSettings: new storeTextSettings(), // storeParagraphSettings: new storeParagraphSettings(), // storeShapeSettings: new storeShapeSettings(), // storeChartSettings: new storeChartSettings(), + storeComments: new storeComments() }; diff --git a/apps/presentationeditor/mobile/src/view/add/AddOther.jsx b/apps/presentationeditor/mobile/src/view/add/AddOther.jsx index e80478b4a..572d77a39 100644 --- a/apps/presentationeditor/mobile/src/view/add/AddOther.jsx +++ b/apps/presentationeditor/mobile/src/view/add/AddOther.jsx @@ -33,6 +33,7 @@ const AddOther = props => { const { t } = useTranslation(); const _t = t('View.Add', {returnObjects: true}); const showInsertLink = props.storeLinkSettings.canAddLink && !props.storeFocusObjects.paragraphLocked; + const hideAddComment = props.hideAddComment(); return ( { }}> - + {!hideAddComment && { + props.closeModal(); + Common.Notifications.trigger('addcomment'); + }}> - + } {showInsertLink &&