diff --git a/src/editor/widgets/comment/Comment.jsx b/src/editor/widgets/comment/Comment.jsx index 1496de6..679e233 100644 --- a/src/editor/widgets/comment/Comment.jsx +++ b/src/editor/widgets/comment/Comment.jsx @@ -11,6 +11,7 @@ const Comment = props => { const [ isMenuVisible, setIsMenuVisible ] = useState(false); const onMakeEditable = _ => { + props.body.draft = true; setIsEditable(true); setIsMenuVisible(false); } diff --git a/src/editor/widgets/comment/CommentWidget.jsx b/src/editor/widgets/comment/CommentWidget.jsx index ac1ed47..0b2273e 100644 --- a/src/editor/widgets/comment/CommentWidget.jsx +++ b/src/editor/widgets/comment/CommentWidget.jsx @@ -30,11 +30,11 @@ const CommentWidget = props => { const all = props.annotation ? props.annotation.bodies.filter(isComment) : []; - // Non-draft comments - const comments = all.filter(b => !b.draft); + // Last draft comment without a creator field goes into the reply field + const draftReply = getDraftReply(all.reverse().find(b => b.draft && !b.creator), all.length > 1); - // Draft reply - const draftReply = getDraftReply(all.find(b => b.draft), comments.length > 0); + // All except draft reply + const comments = all.filter(b => b != draftReply); const onEditReply = evt => { const prev = draftReply.value.trim();