Configurable editor widgets
This commit is contained in:
parent
0e70226aaa
commit
05fcda369b
|
@ -70,17 +70,15 @@ const Editor = props => {
|
||||||
<div ref={element} className="r6o-editor">
|
<div ref={element} className="r6o-editor">
|
||||||
<div className="arrow" />
|
<div className="arrow" />
|
||||||
<div className="inner">
|
<div className="inner">
|
||||||
<CommentWidget
|
{React.Children.map(props.children, child =>
|
||||||
annotation={currentAnnotation}
|
React.cloneElement(child, {
|
||||||
onAppendBody={onAppendBody}
|
annotation : currentAnnotation,
|
||||||
onUpdateBody={onUpdateBody}
|
onAppendBody : onAppendBody,
|
||||||
onRemoveBody={onRemoveBody}
|
onUpdateBody : onUpdateBody,
|
||||||
onSaveAndClose={onOk} />
|
onRemoveBody : onRemoveBody,
|
||||||
|
onSaveAndClose : onOk
|
||||||
<TagWidget
|
}))
|
||||||
annotation={currentAnnotation}
|
}
|
||||||
onAppendBody={onAppendBody}
|
|
||||||
onRemoveBody={onRemoveBody} />
|
|
||||||
|
|
||||||
{ props.readOnly ? (
|
{ props.readOnly ? (
|
||||||
<div className="footer">
|
<div className="footer">
|
||||||
|
|
|
@ -20,12 +20,12 @@ const TagWidget = props => {
|
||||||
|
|
||||||
const onDelete = tag => evt => {
|
const onDelete = tag => evt => {
|
||||||
evt.stopPropagation();
|
evt.stopPropagation();
|
||||||
props.onRemoveTag(tag);
|
props.onRemoveBody(tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
const onKeyDown = evt => {
|
const onKeyDown = evt => {
|
||||||
if (evt.which === 13) { // Enter
|
if (evt.which === 13) { // Enter
|
||||||
props.onAddTag({ type: 'TextualBody', purpose: 'tagging', value: newTag.trim() });
|
props.onAppendBody({ type: 'TextualBody', purpose: 'tagging', value: newTag.trim() });
|
||||||
setNewTag(''); // Clear the input
|
setNewTag(''); // Clear the input
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue