From 7853364f1a505738da7ce9cf3abb556a9eefed11 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 16 Jul 2020 08:54:15 +0530 Subject: [PATCH] Fix opening and closing an existing highlight causes notes to be lost --- src/pyj/read_book/create_annotation.pyj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pyj/read_book/create_annotation.pyj b/src/pyj/read_book/create_annotation.pyj index 9e00c3951f..f26093db4b 100644 --- a/src/pyj/read_book/create_annotation.pyj +++ b/src/pyj/read_book/create_annotation.pyj @@ -669,8 +669,10 @@ class CreateAnnotation: def handle_message(self, msg): if msg.type is 'create-annotation': - self.editing_annot_uuid = None + self.editing_annot_uuid = msg.existing or None self.current_notes = '' + if self.editing_annot_uuid: + self.current_notes = self.annotations_manager.notes_for_highlight(self.editing_annot_uuid) or '' if not self.is_visible: self.view.hide_overlays() self.state = WAITING_FOR_CLICK @@ -679,7 +681,6 @@ class CreateAnnotation: if msg.extents and msg.extents.start.x is not None: self.place_handles(msg.extents) self.in_flow_mode = msg.in_flow_mode - self.editing_annot_uuid = msg.existing or None self.send_message('set-highlight-style', style=self.current_highlight_style) elif msg.type is 'position-handles': if self.state is WAITING_FOR_CLICK: