From 53c842035b96e869e0793dff8081b8ce0c9d2e67 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Fri, 1 May 2020 15:58:25 +0200 Subject: [PATCH] Minor internal API change --- src/editor/Editor.jsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/editor/Editor.jsx b/src/editor/Editor.jsx index 0f8923d..9bb6f38 100644 --- a/src/editor/Editor.jsx +++ b/src/editor/Editor.jsx @@ -24,7 +24,7 @@ const Editor = props => { // Re-render: set derived annotation state & position the editor useEffect(() => { // 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 const annotation = shouldApplyTemplate ? @@ -34,8 +34,7 @@ const Editor = props => { if (!currentAnnotation?.isEqual(annotation)) setCurrentAnnotation(annotation); - // In headless mode, create immediately - if (shouldApplyTemplate && props.headless) + if (shouldApplyTemplate && props.applyImmediately) props.onAnnotationCreated(annotation.toAnnotation()); if (element.current) @@ -80,9 +79,7 @@ const Editor = props => { else props.onAnnotationUpdated(undraft(currentAnnotation), props.annotation); } - }; - - console.log(props); + }; return (