From 8cf539c4d429549af4f0d031e24eecdd627addd9 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Sun, 12 Apr 2020 09:54:09 +0200 Subject: [PATCH] Behavior tweak --- src/editor/Editor.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/editor/Editor.jsx b/src/editor/Editor.jsx index 70e043e..0125adb 100644 --- a/src/editor/Editor.jsx +++ b/src/editor/Editor.jsx @@ -18,11 +18,12 @@ const Editor = props => { // Re-render: set derived annotation state & position the editor useEffect(() => { - setCurrentAnnotation(props.annotation); + if (!currentAnnotation?.isEqual(props.annotation)) + setCurrentAnnotation(props.annotation); if (element.current) setPosition(props.wrapperEl, element.current, props.bounds); - }, [ props.annotation, props.bounds ]); + }, [ props.bounds ]); const onAppendBody = body => setCurrentAnnotation( currentAnnotation.clone({