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 =>
|
const onChangeReplyPurpose = purpose =>
|
||||||
props.onUpdateBody(draftReply, { ...draftReply, purpose: purpose.value });
|
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 (
|
return (
|
||||||
<>
|
<>
|
||||||
{ comments.map((body, idx) =>
|
{ comments.map((body, idx) =>
|
||||||
|
@ -101,13 +107,13 @@ const CommentWidget = props => {
|
||||||
onSaveAndClose={props.onSaveAndClose} />
|
onSaveAndClose={props.onSaveAndClose} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{ !props.readOnly && props.annotation &&
|
{ isReadable && hasReply &&
|
||||||
<div className="r6o-widget comment editable">
|
<div className="r6o-widget comment editable">
|
||||||
<TextEntryField
|
<TextEntryField
|
||||||
focus={props.focus}
|
focus={props.focus}
|
||||||
content={draftReply.value}
|
content={draftReply.value}
|
||||||
editable={true}
|
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}
|
onChange={onEditReply}
|
||||||
onSaveAndClose={() => props.onSaveAndClose()}
|
onSaveAndClose={() => props.onSaveAndClose()}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -98,7 +98,7 @@ const TagWidget = props => {
|
||||||
{!props.readOnly &&
|
{!props.readOnly &&
|
||||||
<Autocomplete
|
<Autocomplete
|
||||||
focus={props.focus}
|
focus={props.focus}
|
||||||
placeholder={i18n.t('Add tag...')}
|
placeholder={props.textPlaceHolder || i18n.t('Add tag...')}
|
||||||
vocabulary={props.vocabulary || []}
|
vocabulary={props.vocabulary || []}
|
||||||
onChange={onDraftChange}
|
onChange={onDraftChange}
|
||||||
onSubmit={onSubmit}/>
|
onSubmit={onSubmit}/>
|
||||||
|
|
Loading…
Reference in New Issue