Minor internal API change

This commit is contained in:
Rainer Simon 2020-05-01 15:58:25 +02:00
parent 574d805008
commit 53c842035b
1 changed files with 3 additions and 6 deletions

View File

@ -24,7 +24,7 @@ const Editor = props => {
// Re-render: set derived annotation state & position the editor // Re-render: set derived annotation state & position the editor
useEffect(() => { useEffect(() => {
// Shorthand: user wants a template applied and this is a selection // Shorthand: user wants a template applied and this is a selection
const shouldApplyTemplate = props.applyTemplate && props.annotation?.isSelection const shouldApplyTemplate = props.applyTemplate && props.annotation?.isSelection;
// Apply template if needed // Apply template if needed
const annotation = shouldApplyTemplate ? const annotation = shouldApplyTemplate ?
@ -34,8 +34,7 @@ const Editor = props => {
if (!currentAnnotation?.isEqual(annotation)) if (!currentAnnotation?.isEqual(annotation))
setCurrentAnnotation(annotation); setCurrentAnnotation(annotation);
// In headless mode, create immediately if (shouldApplyTemplate && props.applyImmediately)
if (shouldApplyTemplate && props.headless)
props.onAnnotationCreated(annotation.toAnnotation()); props.onAnnotationCreated(annotation.toAnnotation());
if (element.current) if (element.current)
@ -80,9 +79,7 @@ const Editor = props => {
else else
props.onAnnotationUpdated(undraft(currentAnnotation), props.annotation); props.onAnnotationUpdated(undraft(currentAnnotation), props.annotation);
} }
}; };
console.log(props);
return ( return (
<div ref={element} className="r6o-editor"> <div ref={element} className="r6o-editor">