0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Disabled context menu edit if editing another comment

refs https://github.com/TryGhost/Team/issues/1710

- if a comment is in edit mode, it stops opening edit for another comment till existing edit mode is exited
This commit is contained in:
Rishabh 2022-07-28 18:49:45 +05:30
parent d28f00656c
commit 9afb36fa53
4 changed files with 4 additions and 4 deletions

View file

@ -107,7 +107,7 @@ const Comment = ({updateIsEditing = null, isEditing, ...props}) => {
<div className="ml-12 sm:ml-[52px] flex gap-5 items-center"> <div className="ml-12 sm:ml-[52px] flex gap-5 items-center">
{!isNotPublished && <Like comment={comment} />} {!isNotPublished && <Like comment={comment} />}
{!isNotPublished && (canReply && (isNotPublished || !props.parent) && <Reply disabled={!!isEditing} comment={comment} toggleReply={toggleReplyMode} isReplying={isInReplyMode} />)} {!isNotPublished && (canReply && (isNotPublished || !props.parent) && <Reply disabled={!!isEditing} comment={comment} toggleReply={toggleReplyMode} isReplying={isInReplyMode} />)}
<More comment={comment} toggleEdit={toggleEditMode} /> <More comment={comment} toggleEdit={toggleEditMode} disableEditing={isEditing} />
</div> </div>
</div> </div>
</div> </div>

View file

@ -30,7 +30,7 @@ const More = (props) => {
return ( return (
<div className="relative"> <div className="relative">
{show ? <button onClick={toggleContextMenu} className="outline-0"><MoreIcon className='transition duration-50 ease-linear gh-comments-icon gh-comments-icon-more outline-0 fill-neutral-400 dark:fill-rgba(255,255,255,0.5) hover:fill-neutral-600' /></button> : null} {show ? <button onClick={toggleContextMenu} className="outline-0"><MoreIcon className='transition duration-50 ease-linear gh-comments-icon gh-comments-icon-more outline-0 fill-neutral-400 dark:fill-rgba(255,255,255,0.5) hover:fill-neutral-600' /></button> : null}
{isContextMenuOpen ? <CommentContextMenu comment={comment} close={closeContextMenu} toggleEdit={props.toggleEdit} /> : null} {isContextMenuOpen ? <CommentContextMenu comment={comment} close={closeContextMenu} toggleEdit={props.toggleEdit} disableEditing={props.disableEditing} /> : null}
</div> </div>
); );
}; };

View file

@ -11,7 +11,7 @@ const AuthorContextMenu = (props) => {
return ( return (
<div className="flex flex-col"> <div className="flex flex-col">
<button className="w-full mb-3 text-left text-[14px]" onClick={props.toggleEdit}> <button className="w-full mb-3 text-left text-[14px]" onClick={props.toggleEdit} disabled={props.disableEditing}>
Edit Edit
</button> </button>
<button className="w-full text-left text-[14px] text-red-600" onClick={deleteComment}> <button className="w-full text-left text-[14px] text-red-600" onClick={deleteComment}>

View file

@ -40,7 +40,7 @@ const CommentContextMenu = (props) => {
let contextMenu = null; let contextMenu = null;
if (comment.status === 'published') { if (comment.status === 'published') {
if (isAuthor) { if (isAuthor) {
contextMenu = <AuthorContextMenu comment={comment} close={props.close} toggleEdit={props.toggleEdit} />; contextMenu = <AuthorContextMenu comment={comment} close={props.close} toggleEdit={props.toggleEdit} disableEditing={props.disableEditing} />;
} else { } else {
if (isAdmin) { if (isAdmin) {
contextMenu = <AdminContextMenu comment={comment} close={props.close}/>; contextMenu = <AdminContextMenu comment={comment} close={props.close}/>;