[SSE mobile] Add comments
This commit is contained in:
parent
69b5025f83
commit
56e316738e
|
@ -60,12 +60,12 @@ class CommentsController extends Component {
|
||||||
api.asc_registerCallback('asc_onChangeCommentData', this.changeCommentData.bind(this));
|
api.asc_registerCallback('asc_onChangeCommentData', this.changeCommentData.bind(this));
|
||||||
api.asc_registerCallback('asc_onShowComment', this.changeShowComments.bind(this));
|
api.asc_registerCallback('asc_onShowComment', this.changeShowComments.bind(this));
|
||||||
api.asc_registerCallback('asc_onHideComment', this.hideComments.bind(this));
|
api.asc_registerCallback('asc_onHideComment', this.hideComments.bind(this));
|
||||||
});
|
|
||||||
|
|
||||||
Common.Notifications.on('comments:filterchange', this.onFilterChange.bind(this)); // for sse
|
if (window.editorType === 'sse') {
|
||||||
|
api.asc_registerCallback('asc_onActiveSheetChanged', this.onApiActiveSheetChanged.bind(this));
|
||||||
Common.Notifications.on('configOptionsFill', () => {
|
Common.Notifications.on('comments:filterchange', this.onFilterChange.bind(this));
|
||||||
this.curUserId = this.appOptions.user.id;
|
Common.Notifications.on('sheet:active', this.onApiActiveSheetChanged.bind(this));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Common.Notifications.on('document:ready', () => {
|
Common.Notifications.on('document:ready', () => {
|
||||||
|
@ -77,8 +77,13 @@ class CommentsController extends Component {
|
||||||
isLiveCommenting ? api.asc_showComments(resolved) : api.asc_hideComments();
|
isLiveCommenting ? api.asc_showComments(resolved) : api.asc_hideComments();
|
||||||
/** coauthoring end **/
|
/** coauthoring end **/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.curUserId = this.props.users.currentUser.asc_getIdOriginal();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
onApiActiveSheetChanged (index) {
|
||||||
|
this.onFilterChange(['doc', 'sheet' + Common.EditorApi.get().asc_getWorksheetId(index)]);
|
||||||
|
}
|
||||||
addComment (id, data) {
|
addComment (id, data) {
|
||||||
const comment = this.readSDKComment(id, data);
|
const comment = this.readSDKComment(id, data);
|
||||||
if (comment) {
|
if (comment) {
|
||||||
|
|
|
@ -54,8 +54,8 @@ export class storeComments {
|
||||||
if (!this.groupCollectionComments[groupName]) {
|
if (!this.groupCollectionComments[groupName]) {
|
||||||
this.groupCollectionComments[groupName] = [];
|
this.groupCollectionComments[groupName] = [];
|
||||||
}
|
}
|
||||||
this.groupCollectionComments[groupname].push(comment);
|
this.groupCollectionComments[groupName].push(comment);
|
||||||
if (this.filter.indexOf(groupname) !== -1) {
|
if (typeof this.filter === 'object' && this.filter.indexOf(groupName) !== -1) {
|
||||||
this.groupCollectionFilter.push(comment);
|
this.groupCollectionFilter.push(comment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ export class storeComments {
|
||||||
const index = store.indexOf(comment);
|
const index = store.indexOf(comment);
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.groupCollectionComments[name].splice(index, 1);
|
this.groupCollectionComments[name].splice(index, 1);
|
||||||
if (this.filter.indexOf(name) !== -1) {
|
if (typeof this.filter === 'object' && this.filter.indexOf(name) !== -1) {
|
||||||
this.groupCollectionFilter.splice(this.groupCollectionFilter.indexOf(comment), 1);
|
this.groupCollectionFilter.splice(this.groupCollectionFilter.indexOf(comment), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,9 +135,9 @@ export class storeComments {
|
||||||
let model;
|
let model;
|
||||||
for (let name in this.groupCollectionComments) {
|
for (let name in this.groupCollectionComments) {
|
||||||
const store = this.groupCollectionComments[name];
|
const store = this.groupCollectionComments[name];
|
||||||
const id = id.isArray() ? id[0] : id;
|
const uid = typeof id === 'object' && id.isArray() ? id[0] : id;
|
||||||
model = store.find((item) => {
|
model = store.find((item) => {
|
||||||
return item.uid === id;
|
return item.uid === uid;
|
||||||
});
|
});
|
||||||
if (model) return model;
|
if (model) return model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,10 @@ const AddCommentPopup = inject("storeComments")(observer(props => {
|
||||||
<Navbar>
|
<Navbar>
|
||||||
<NavLeft>
|
<NavLeft>
|
||||||
<Link onClick={() => {
|
<Link onClick={() => {
|
||||||
props.closeAddComment();
|
|
||||||
f7.popup.close('.add-comment-popup');
|
f7.popup.close('.add-comment-popup');
|
||||||
|
setTimeout(() => {
|
||||||
|
props.closeAddComment();
|
||||||
|
}, 500)
|
||||||
}}>{_t.textCancel}</Link>
|
}}>{_t.textCancel}</Link>
|
||||||
</NavLeft>
|
</NavLeft>
|
||||||
<NavTitle>{_t.textAddComment}</NavTitle>
|
<NavTitle>{_t.textAddComment}</NavTitle>
|
||||||
|
@ -40,8 +42,10 @@ const AddCommentPopup = inject("storeComments")(observer(props => {
|
||||||
<Link className={stateText.length === 0 && 'disabled'}
|
<Link className={stateText.length === 0 && 'disabled'}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (props.onAddNewComment(stateText, false)) {
|
if (props.onAddNewComment(stateText, false)) {
|
||||||
props.closeAddComment();
|
|
||||||
f7.popup.close('.add-comment-popup');
|
f7.popup.close('.add-comment-popup');
|
||||||
|
setTimeout(() => {
|
||||||
|
props.closeAddComment();
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
{Device.android ? <Icon icon='icon-done-comment-white'/> : _t.textDone}
|
{Device.android ? <Icon icon='icon-done-comment-white'/> : _t.textDone}
|
||||||
|
|
|
@ -46,7 +46,8 @@
|
||||||
"textInsert": "Insert",
|
"textInsert": "Insert",
|
||||||
"textInvalidRange": "ERROR! Invalid cells range",
|
"textInvalidRange": "ERROR! Invalid cells range",
|
||||||
"textSortAndFilter": "Sort and Filter",
|
"textSortAndFilter": "Sort and Filter",
|
||||||
"textFilter": "Filter"
|
"textFilter": "Filter",
|
||||||
|
"textComment": "Comment"
|
||||||
},
|
},
|
||||||
"Edit" : {
|
"Edit" : {
|
||||||
"textSelectObjectToEdit": "Select object to edit",
|
"textSelectObjectToEdit": "Select object to edit",
|
||||||
|
@ -321,7 +322,21 @@
|
||||||
"textBack": "Back",
|
"textBack": "Back",
|
||||||
"textUsers": "Users",
|
"textUsers": "Users",
|
||||||
"textEditUser": "Users who are editing the file:",
|
"textEditUser": "Users who are editing the file:",
|
||||||
"textComments": "Comments"
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,15 +1,22 @@
|
||||||
|
|
||||||
import React, { Component } from 'react'
|
import React, { Component, Fragment } from 'react'
|
||||||
import { inject } from "mobx-react";
|
import { inject } from "mobx-react";
|
||||||
import { f7 } from 'framework7-react';
|
import { f7 } from 'framework7-react';
|
||||||
import { withTranslation } from 'react-i18next';
|
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 { onAdvancedOptions } from './settings/Download.jsx';
|
import { onAdvancedOptions } from './settings/Download.jsx';
|
||||||
|
import {
|
||||||
|
AddCommentController,
|
||||||
|
CommentsController,
|
||||||
|
EditCommentController,
|
||||||
|
ViewCommentsController
|
||||||
|
} from "../../../../common/mobile/lib/controller/collaboration/Comments";
|
||||||
|
|
||||||
@inject("storeAppOptions", "storeFocusObjects", "storeCellSettings", "storeTextSettings", "storeChartSettings", "storeSpreadsheetSettings", "storeSpreadsheetInfo")
|
@inject("storeAppOptions", "storeFocusObjects", "storeCellSettings", "storeTextSettings", "storeChartSettings", "storeSpreadsheetSettings", "storeSpreadsheetInfo")
|
||||||
class MainController extends Component {
|
class MainController extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props);
|
||||||
|
window.editorType = 'sse';
|
||||||
}
|
}
|
||||||
|
|
||||||
initSdk() {
|
initSdk() {
|
||||||
|
@ -318,7 +325,15 @@ class MainController extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <CollaborationController />
|
return (
|
||||||
|
<Fragment>
|
||||||
|
<CollaborationController />
|
||||||
|
<CommentsController />
|
||||||
|
<AddCommentController />
|
||||||
|
<EditCommentController />
|
||||||
|
<ViewCommentsController />
|
||||||
|
</Fragment>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
|
|
@ -63,6 +63,8 @@ const Statusbar = inject('sheets')(props => {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
api.asc_showWorksheet(model.index);
|
api.asc_showWorksheet(model.index);
|
||||||
sheets.setActiveWorksheet(i);
|
sheets.setActiveWorksheet(i);
|
||||||
|
|
||||||
|
Common.Notifications.trigger('sheet:active', model.index);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onAddTabClicked = () => {
|
const onAddTabClicked = () => {
|
||||||
|
|
|
@ -18,9 +18,17 @@ class AddOtherController extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hideAddComment () {
|
||||||
|
const cellinfo = Common.EditorApi.get().asc_getCellInfo();
|
||||||
|
const iscelllocked = cellinfo.asc_getLocked();
|
||||||
|
const seltype = cellinfo.asc_getSelectionType();
|
||||||
|
return !(seltype === Asc.c_oAscSelectionType.RangeCells && !iscelllocked);
|
||||||
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
return (
|
return (
|
||||||
<AddOther
|
<AddOther closeModal={this.closeModal}
|
||||||
|
hideAddComment={this.hideAddComment}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
@import '../../../../common/mobile/resources/less/icons.less';
|
@import '../../../../common/mobile/resources/less/icons.less';
|
||||||
@import '../../../../common/mobile/resources/less/dataview.less';
|
@import '../../../../common/mobile/resources/less/dataview.less';
|
||||||
@import '../../../../common/mobile/resources/less/search.less';
|
@import '../../../../common/mobile/resources/less/search.less';
|
||||||
|
@import '../../../../common/mobile/resources/less/contextmenu.less';
|
||||||
|
@import '../../../../common/mobile/resources/less/comments.less';
|
||||||
@import './app-material.less';
|
@import './app-material.less';
|
||||||
@import './app-ios.less';
|
@import './app-ios.less';
|
||||||
@import './icons-ios.less';
|
@import './icons-ios.less';
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {storeAppOptions} from "./appOptions";
|
||||||
// import {storeTableSettings} from "./tableSettings";
|
// import {storeTableSettings} from "./tableSettings";
|
||||||
import {storeChartSettings} from "./chartSettings";
|
import {storeChartSettings} from "./chartSettings";
|
||||||
import {storeSpreadsheetSettings} from "./spreadsheetSettings";
|
import {storeSpreadsheetSettings} from "./spreadsheetSettings";
|
||||||
|
import {storeComments} from "../../../../common/mobile/lib/store/comments";
|
||||||
|
|
||||||
export const stores = {
|
export const stores = {
|
||||||
storeFocusObjects: new storeFocusObjects(),
|
storeFocusObjects: new storeFocusObjects(),
|
||||||
|
@ -30,8 +31,9 @@ export const stores = {
|
||||||
storeShapeSettings: new storeShapeSettings(),
|
storeShapeSettings: new storeShapeSettings(),
|
||||||
storeChartSettings: new storeChartSettings(),
|
storeChartSettings: new storeChartSettings(),
|
||||||
storePalette: new storePalette(),
|
storePalette: new storePalette(),
|
||||||
storeCellSettings: new storeCellSettings()
|
storeCellSettings: new storeCellSettings(),
|
||||||
// storeImageSettings: new storeImageSettings(),
|
// storeImageSettings: new storeImageSettings(),
|
||||||
// storeTableSettings: new storeTableSettings()
|
// storeTableSettings: new storeTableSettings()
|
||||||
|
storeComments: new storeComments()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,18 @@ import { useTranslation } from 'react-i18next';
|
||||||
const AddOther = props => {
|
const AddOther = props => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('View.Add', {returnObjects: true});
|
const _t = t('View.Add', {returnObjects: true});
|
||||||
|
const hideAddComment = props.hideAddComment();
|
||||||
return (
|
return (
|
||||||
<List>
|
<List>
|
||||||
<ListItem title={_t.textImage} link={'/add-image/'}>
|
<ListItem title={_t.textImage} link={'/add-image/'}>
|
||||||
<Icon slot="media" icon="icon-insimage"></Icon>
|
<Icon slot="media" icon="icon-insimage"></Icon>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
{!hideAddComment && <ListItem title={_t.textComment} onClick={() => {
|
||||||
|
props.closeModal();
|
||||||
|
Common.Notifications.trigger('addcomment');
|
||||||
|
}}>
|
||||||
|
<Icon slot="media" icon="icon-insert-comment"></Icon>
|
||||||
|
</ListItem>}
|
||||||
<ListItem title={_t.textLink} link={'/add-link/'}>
|
<ListItem title={_t.textLink} link={'/add-link/'}>
|
||||||
<Icon slot="media" icon="icon-link"></Icon>
|
<Icon slot="media" icon="icon-link"></Icon>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
|
|
Loading…
Reference in a new issue