diff --git a/apps/common/mobile/lib/controller/collaboration/Comments.jsx b/apps/common/mobile/lib/controller/collaboration/Comments.jsx
index b363eb458a..331adc1033 100644
--- a/apps/common/mobile/lib/controller/collaboration/Comments.jsx
+++ b/apps/common/mobile/lib/controller/collaboration/Comments.jsx
@@ -218,8 +218,20 @@ class CommentsController extends Component {
class AddCommentController extends Component {
constructor(props) {
super(props);
+ this.closeAddComment = this.closeAddComment.bind(this);
this.getUserInfo = this.getUserInfo.bind(this);
this.onAddNewComment = this.onAddNewComment.bind(this);
+
+ this.state = {
+ isOpen: false
+ };
+
+ Common.Notifications.on('addcomment', () => {
+ this.setState({isOpen: true});
+ });
+ }
+ closeAddComment () {
+ this.setState({isOpen: false});
}
getUserInfo () {
this.currentUser = this.props.users.currentUser;
@@ -255,13 +267,8 @@ class AddCommentController extends Component {
return false;
}
render() {
- const isOpen = this.props.storeComments.isOpenAddComment;
- let userInfo;
- if (isOpen) {
- userInfo = this.getUserInfo();
- }
return(
- isOpen ? : null
+ this.state.isOpen ? : null
)
}
}
diff --git a/apps/common/mobile/lib/store/comments.js b/apps/common/mobile/lib/store/comments.js
index 1454346092..ee08defaf5 100644
--- a/apps/common/mobile/lib/store/comments.js
+++ b/apps/common/mobile/lib/store/comments.js
@@ -102,15 +102,6 @@ export class storeComments {
return false;
}
- // Add comment modal window
- @observable isOpenAddComment = false;
-
- @action openAddComment (open) {
- if (open !== this.isOpenAddComment) {
- this.isOpenAddComment = open;
- }
- }
-
// Edit comment
currentComment = null;
@observable isOpenEditComment = false;
diff --git a/apps/common/mobile/lib/view/collaboration/Comments.jsx b/apps/common/mobile/lib/view/collaboration/Comments.jsx
index d90cc38860..16f1ba3ced 100644
--- a/apps/common/mobile/lib/view/collaboration/Comments.jsx
+++ b/apps/common/mobile/lib/view/collaboration/Comments.jsx
@@ -19,7 +19,7 @@ const AddCommentPopup = inject("storeComments")(observer(props => {
{
- props.storeComments.openAddComment(false);
+ props.closeAddComment();
f7.popup.close('.add-comment-popup');
}}>{_t.textCancel}
@@ -28,7 +28,7 @@ const AddCommentPopup = inject("storeComments")(observer(props => {
{
if (props.onAddNewComment(stateText, false)) {
- props.storeComments.openAddComment(false);
+ props.closeAddComment();
f7.popup.close('.add-comment-popup');
}
}}>
@@ -87,14 +87,14 @@ const AddCommentDialog = inject("storeComments")(observer(props => {
const cancel = document.getElementById('comment-cancel');
cancel.addEventListener('click', () => {
f7.dialog.close();
- props.storeComments.openAddComment(false);
+ props.closeAddComment();
});
const done = document.getElementById('comment-done');
done.addEventListener('click', () => {
const value = document.getElementById('comment-text').value;
if (value.length > 0 && props.onAddNewComment(value, false)) {
f7.dialog.close();
- props.storeComments.openAddComment(false);
+ props.closeAddComment();
}
});
const area = document.getElementById('comment-text');
@@ -118,8 +118,8 @@ const AddCommentDialog = inject("storeComments")(observer(props => {
const AddComment = props => {
return (
Device.phone ?
- :
-
+ :
+
)
};
diff --git a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx
index 5a09e6f849..3e11cd7063 100644
--- a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx
+++ b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx
@@ -47,6 +47,12 @@ class ContextMenu extends ContextMenuController {
onMenuItemClick(action) {
super.onMenuItemClick(action);
+ switch (action) {
+ case 'addcomment':
+ Common.Notifications.trigger('addcomment');
+ break;
+ }
+
console.log("click context menu item: " + action);
}
@@ -78,7 +84,7 @@ class ContextMenu extends ContextMenuController {
});
}
- if ( canViewComments && this.isComments && isEdit ) {
+ if ( canViewComments && this.isComments && !isEdit ) {
itemsText.push({
caption: /*me.menuViewComment*/'View Comment',
event: 'viewcomment'
@@ -152,6 +158,24 @@ class ContextMenu extends ContextMenuController {
});
}
+ // For test
+ if ( this.isComments && canViewComments ) {
+ itemsText.push({
+ caption: /*me.menuViewComment*/'View Comment',
+ event: 'viewcomment'
+ });
+ }
+
+ const isObject = isShape || isChart || isImage || isTable;
+ const hideAddComment = !canViewComments || api.can_AddQuotedComment() === false || lockedText || lockedTable || lockedImage || lockedHeader || (!isText && isObject);
+ if ( !hideAddComment ) {
+ itemsText.push({
+ caption: /*me.menuAddComment*/'Add Comment',
+ event: 'addcomment'
+ });
+ }
+ // end test
+
if ( isTable && api.CheckBeforeMergeCells() && !lockedTable && !lockedHeader) {
itemsText.push({
caption: /*me.menuMerge*/'Merge',
@@ -215,14 +239,14 @@ class ContextMenu extends ContextMenuController {
});
}
- const isObject = isShape || isChart || isImage || isTable;
+ /*const isObject = isShape || isChart || isImage || isTable;
const hideAddComment = !canViewComments || api.can_AddQuotedComment() === false || lockedText || lockedTable || lockedImage || lockedHeader || (!isText && isObject);
if ( !hideAddComment ) {
itemsText.push({
- caption: /*me.menuAddComment*/'Add Comment',
+ caption: 'Add Comment',
event: 'addcomment'
});
- }
+ }*/
}
}
diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx
index be5a0685e3..fbed1a5e1c 100644
--- a/apps/documenteditor/mobile/src/page/main.jsx
+++ b/apps/documenteditor/mobile/src/page/main.jsx
@@ -8,7 +8,6 @@ import EditOptions from '../view/edit/Edit';
import AddOptions from '../view/add/Add';
import Settings from '../view/settings/Settings';
import Collaboration from '../../../../common/mobile/lib/view/collaboration/Collaboration.jsx'
-import { AddCommentController } from '../../../../common/mobile/lib/controller/collaboration/Comments.jsx';
import { Device } from '../../../../common/mobile/utils/device'
import { Search, SearchSettings } from '../controller/Search';
import ContextMenu from '../controller/ContextMenu';
diff --git a/apps/documenteditor/mobile/src/view/add/AddOther.jsx b/apps/documenteditor/mobile/src/view/add/AddOther.jsx
index 15dc2e139a..25040fc497 100644
--- a/apps/documenteditor/mobile/src/view/add/AddOther.jsx
+++ b/apps/documenteditor/mobile/src/view/add/AddOther.jsx
@@ -202,7 +202,7 @@ const AddOther = props => {
{
props.closeModal();
- props.storeComments.openAddComment(true);
+ Common.Notifications.trigger('addcomment');
}}>