Merge pull request #113 from ahammouda/main
Added ability to change placeholder text for comment/tag, and make comment replies optional
This commit is contained in:
commit
9c8810eb36
|
@ -87,6 +87,12 @@ const CommentWidget = props => {
|
|||
const onChangeReplyPurpose = purpose =>
|
||||
props.onUpdateBody(draftReply, { ...draftReply, purpose: purpose.value });
|
||||
|
||||
// Pre-condition: will be true if the annotation exists, and Annotorious is not in read-only mode
|
||||
const isReadable = (!props.readOnly && props.annotation);
|
||||
|
||||
// Extra condtion to: reply field exists if there is no comment yet, or disableReply is false.
|
||||
const hasReply = comments.length === 0 || !props.disableReply;
|
||||
|
||||
return (
|
||||
<>
|
||||
{ comments.map((body, idx) =>
|
||||
|
@ -101,13 +107,13 @@ const CommentWidget = props => {
|
|||
onSaveAndClose={props.onSaveAndClose} />
|
||||
)}
|
||||
|
||||
{ !props.readOnly && props.annotation &&
|
||||
{ isReadable && hasReply &&
|
||||
<div className="r6o-widget comment editable">
|
||||
<TextEntryField
|
||||
focus={props.focus}
|
||||
content={draftReply.value}
|
||||
editable={true}
|
||||
placeholder={comments.length > 0 ? i18n.t('Add a reply...') : i18n.t('Add a comment...')}
|
||||
placeholder={comments.length > 0 ? i18n.t('Add a reply...') : (props.textPlaceHolder || i18n.t('Add a comment...'))}
|
||||
onChange={onEditReply}
|
||||
onSaveAndClose={() => props.onSaveAndClose()}
|
||||
/>
|
||||
|
|
|
@ -98,7 +98,7 @@ const TagWidget = props => {
|
|||
{!props.readOnly &&
|
||||
<Autocomplete
|
||||
focus={props.focus}
|
||||
placeholder={i18n.t('Add tag...')}
|
||||
placeholder={props.textPlaceHolder || i18n.t('Add tag...')}
|
||||
vocabulary={props.vocabulary || []}
|
||||
onChange={onDraftChange}
|
||||
onSubmit={onSubmit}/>
|
||||
|
|
Loading…
Reference in New Issue