diff --git a/src/TextAnnotator.jsx b/src/TextAnnotator.jsx index 6abebd1..aad0121 100644 --- a/src/TextAnnotator.jsx +++ b/src/TextAnnotator.jsx @@ -263,6 +263,7 @@ export default class TextAnnotator extends Component { selectedElement={this.state.selectedDOMElement} config={this.props.config} env={this.props.env} + isRemovable={this.props.isRemovable} onAnnotationCreated={this.onCreateOrUpdateAnnotation('onAnnotationCreated')} onAnnotationUpdated={this.onCreateOrUpdateAnnotation('onAnnotationUpdated')} onAnnotationDeleted={this.onDeleteAnnotation} diff --git a/src/editor/Editor.jsx b/src/editor/Editor.jsx index 64a7a80..0a44d93 100644 --- a/src/editor/Editor.jsx +++ b/src/editor/Editor.jsx @@ -132,9 +132,18 @@ const Editor = props => { } }; + const onRemove = () => props.onAnnotationDeleted(props.annotation); + // Use default comment + tag widget unless host app overrides const widgets = props.config.widgets ? props.config.widgets.map(getWidget) : DEFAULT_WIDGETS; + + const removable = + currentAnnotation && + currentAnnotation.bodies.length > 0 && + !currentAnnotation.isSelection && + (props.isRemovable ? props.isRemovable(currentAnnotation) : true); + return (