[common] Fig Bug 48484
This commit is contained in:
parent
47a4436d06
commit
55de02cb15
|
@ -481,7 +481,8 @@ class ViewCommentsController extends Component {
|
||||||
}
|
}
|
||||||
deleteComment (comment) {
|
deleteComment (comment) {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
Device.phone ? f7.sheet.close('#view-comment-sheet') : f7.popover.close('#view-comment-popover');
|
|
||||||
|
this.props.storeComments.removeShowComment(comment.uid);
|
||||||
comment && api.asc_removeComment(comment.uid);
|
comment && api.asc_removeComment(comment.uid);
|
||||||
}
|
}
|
||||||
deleteReply (comment, reply) {
|
deleteReply (comment, reply) {
|
||||||
|
|
|
@ -39,6 +39,16 @@ export class storeComments {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeShowComment(id) {
|
||||||
|
const index = this.showComments.findIndex((comment) => {
|
||||||
|
return comment.uid === id;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (index !== -1) {
|
||||||
|
this.showComments.splice(index, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addComment (comment) {
|
addComment (comment) {
|
||||||
comment.groupName ? this.groupCollectionComments.push(comment) : this.collectionComments.push(comment);
|
comment.groupName ? this.groupCollectionComments.push(comment) : this.collectionComments.push(comment);
|
||||||
}
|
}
|
||||||
|
|
|
@ -740,7 +740,6 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
|
|
||||||
const viewMode = !storeAppOptions.canComments;
|
const viewMode = !storeAppOptions.canComments;
|
||||||
|
|
||||||
const comments = storeComments.showComments;
|
const comments = storeComments.showComments;
|
||||||
|
|
||||||
const [currentIndex, setCurrentIndex] = useState(0);
|
const [currentIndex, setCurrentIndex] = useState(0);
|
||||||
|
@ -767,6 +766,11 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(!comment) {
|
||||||
|
Device.phone ? f7.sheet.close('#view-comment-sheet') : f7.popover.close('#view-comment-popover');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<Toolbar position='bottom'>
|
<Toolbar position='bottom'>
|
||||||
|
@ -779,77 +783,78 @@ const CommentList = inject("storeComments", "storeAppOptions")(observer(({storeC
|
||||||
</div>
|
</div>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
<div className='pages'>
|
<div className='pages'>
|
||||||
<Page className='page-current-comment'>
|
<Page className='page-current-comment'>
|
||||||
<List className='comment-list'>
|
<List className='comment-list'>
|
||||||
<ListItem>
|
<ListItem>
|
||||||
<div slot='header' className='comment-header'>
|
<div slot='header' className='comment-header'>
|
||||||
<div className='left'>
|
<div className='left'>
|
||||||
{isAndroid && <div className='initials' style={{backgroundColor: `${comment.userColor ? comment.userColor : '#cfcfcf'}`}}>{comment.userInitials}</div>}
|
{isAndroid && <div className='initials' style={{backgroundColor: `${comment.userColor ? comment.userColor : '#cfcfcf'}`}}>{comment.userInitials}</div>}
|
||||||
<div>
|
<div>
|
||||||
<div className='user-name'>{comment.userName}</div>
|
<div className='user-name'>{comment.userName}</div>
|
||||||
<div className='comment-date'>{comment.date}</div>
|
<div className='comment-date'>{comment.date}</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{!viewMode &&
|
|
||||||
<div className='right'>
|
|
||||||
<div className='comment-resolve' onClick={() => {onResolveComment(comment);}}><Icon icon={comment.resolved ? 'icon-resolve-comment check' : 'icon-resolve-comment'} /></div>
|
|
||||||
<div className='comment-menu'
|
|
||||||
onClick={() => {openActionComment(true);}}
|
|
||||||
><Icon icon='icon-menu-comment'/></div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div slot='footer'>
|
|
||||||
{comment.quote && <div className='comment-quote'>{sliceQuote(comment.quote)}</div>}
|
|
||||||
<div className='comment-text'><pre>{pickLink(comment.comment)}</pre></div>
|
|
||||||
{comment.replies.length > 0 &&
|
|
||||||
<ul className='reply-list'>
|
|
||||||
{comment.replies.map((reply, indexReply) => {
|
|
||||||
return (
|
|
||||||
<li key={`reply-${indexReply}`}
|
|
||||||
className='reply-item'
|
|
||||||
>
|
|
||||||
<div className='item-content'>
|
|
||||||
<div className='item-inner'>
|
|
||||||
<div className='item-title'>
|
|
||||||
<div slot='header' className='reply-header'>
|
|
||||||
<div className='left'>
|
|
||||||
{isAndroid && <div className='initials' style={{backgroundColor: `${reply.userColor ? reply.userColor : '#cfcfcf'}`}}>{reply.userInitials}</div>}
|
|
||||||
<div>
|
|
||||||
<div className='user-name'>{reply.userName}</div>
|
|
||||||
<div className='reply-date'>{reply.date}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{!viewMode &&
|
|
||||||
<div className='right'>
|
|
||||||
<div className='reply-menu'
|
|
||||||
onClick={() => {setReply(reply); openActionReply(true);}}
|
|
||||||
>
|
|
||||||
<Icon icon='icon-menu-comment'/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
<div slot='footer'>
|
|
||||||
<div className='reply-text'><pre>{pickLink(reply.reply)}</pre></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</div>
|
||||||
)
|
{!viewMode &&
|
||||||
})}
|
<div className='right'>
|
||||||
</ul>
|
<div className='comment-resolve' onClick={() => {onResolveComment(comment);}}><Icon icon={comment.resolved ? 'icon-resolve-comment check' : 'icon-resolve-comment'} /></div>
|
||||||
}
|
<div className='comment-menu'
|
||||||
</div>
|
onClick={() => {openActionComment(true);}}
|
||||||
</ListItem>
|
><Icon icon='icon-menu-comment'/></div>
|
||||||
</List>
|
</div>
|
||||||
<CommentActions comment={comment} onCommentMenuClick={onCommentMenuClick} opened={commentActionsOpened} openActionComment={openActionComment}/>
|
}
|
||||||
<ReplyActions comment={comment} reply={reply} onCommentMenuClick={onCommentMenuClick} opened={replyActionsOpened} openActionReply={openActionReply}/>
|
</div>
|
||||||
</Page>
|
<div slot='footer'>
|
||||||
|
{comment.quote && <div className='comment-quote'>{sliceQuote(comment.quote)}</div>}
|
||||||
|
<div className='comment-text'><pre>{pickLink(comment.comment)}</pre></div>
|
||||||
|
{comment.replies.length > 0 &&
|
||||||
|
<ul className='reply-list'>
|
||||||
|
{comment.replies.map((reply, indexReply) => {
|
||||||
|
return (
|
||||||
|
<li key={`reply-${indexReply}`}
|
||||||
|
className='reply-item'
|
||||||
|
>
|
||||||
|
<div className='item-content'>
|
||||||
|
<div className='item-inner'>
|
||||||
|
<div className='item-title'>
|
||||||
|
<div slot='header' className='reply-header'>
|
||||||
|
<div className='left'>
|
||||||
|
{isAndroid && <div className='initials' style={{backgroundColor: `${reply.userColor ? reply.userColor : '#cfcfcf'}`}}>{reply.userInitials}</div>}
|
||||||
|
<div>
|
||||||
|
<div className='user-name'>{reply.userName}</div>
|
||||||
|
<div className='reply-date'>{reply.date}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{!viewMode &&
|
||||||
|
<div className='right'>
|
||||||
|
<div className='reply-menu'
|
||||||
|
onClick={() => {setReply(reply); openActionReply(true);}}
|
||||||
|
>
|
||||||
|
<Icon icon='icon-menu-comment'/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div slot='footer'>
|
||||||
|
<div className='reply-text'><pre>{pickLink(reply.reply)}</pre></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</ListItem>
|
||||||
|
</List>
|
||||||
|
<CommentActions comment={comment} onCommentMenuClick={onCommentMenuClick} opened={commentActionsOpened} openActionComment={openActionComment}/>
|
||||||
|
<ReplyActions comment={comment} reply={reply} onCommentMenuClick={onCommentMenuClick} opened={replyActionsOpened} openActionReply={openActionReply}/>
|
||||||
|
</Page>
|
||||||
</div>
|
</div>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)
|
)
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const ViewCommentSheet = ({closeCurComments, onCommentMenuClick, onResolveComment}) => {
|
const ViewCommentSheet = ({closeCurComments, onCommentMenuClick, onResolveComment}) => {
|
||||||
|
|
Loading…
Reference in a new issue