diff --git a/src/pyj/range_utils.pyj b/src/pyj/range_utils.pyj index b408f796d9..a69a1116ec 100644 --- a/src/pyj/range_utils.pyj +++ b/src/pyj/range_utils.pyj @@ -143,8 +143,7 @@ def select_crw(crw): sel.removeAllRanges() sel.addRange(r) return True - else: - print(f'range-wrapper: {crw} does not exist') + print(f'range-wrapper: {crw} does not exist') return False diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index c525133993..793ff5e1d9 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -877,8 +877,12 @@ class IframeBoss: elif dtype is 'drag-scroll': self.scroll_to_extend_annotation(data.backwards) elif dtype is 'edit-highlight': - crw_ = {v: k for k, v in Object.entries(annot_id_uuid_map)}[data.uuid] - if crw_ and select_crw(crw_): + found_highlight_to_edit = False + for qcrw, quuid in Object.entries(annot_id_uuid_map): + if quuid is data.uuid and select_crw(qcrw): + found_highlight_to_edit = True + break + if found_highlight_to_edit: self.ensure_selection_visible() window.setTimeout(def(): self.send_message('annotations', type='edit-highlight')