mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
A couple more places that should take into account that there can be multiple annot_ids pointing to an annot uuid in annot_id_uuid_map
This commit is contained in:
parent
8828bc0e61
commit
d75c0ff652
@ -891,19 +891,22 @@ class IframeBoss:
|
||||
self.send_message('annotations', type='edit-highlight-failed', uuid=data.uuid)
|
||||
elif dtype is 'notes-edited':
|
||||
cls = 'crw-has-dot'
|
||||
crw_ = {v: k for k, v in Object.entries(annot_id_uuid_map)}[data.uuid]
|
||||
if crw_:
|
||||
node = last_span_for_crw(crw_)
|
||||
if node:
|
||||
if data.has_notes:
|
||||
node.classList.add(cls)
|
||||
else:
|
||||
node.classList.remove(cls)
|
||||
for qcrw, quuid in Object.entries(annot_id_uuid_map):
|
||||
if quuid is data.uuid:
|
||||
node = last_span_for_crw(qcrw)
|
||||
if node:
|
||||
if data.has_notes:
|
||||
node.classList.add(cls)
|
||||
else:
|
||||
node.classList.remove(cls)
|
||||
elif dtype is 'remove-highlight':
|
||||
crw_ = {v: k for k, v in Object.entries(annot_id_uuid_map)}[data.uuid]
|
||||
if crw_:
|
||||
unwrap_crw(crw_)
|
||||
v'delete annot_id_uuid_map[crw_]'
|
||||
found_highlight_to_remove = False
|
||||
for qcrw, quuid in Object.entries(annot_id_uuid_map):
|
||||
if quuid is data.uuid:
|
||||
found_highlight_to_remove = True
|
||||
unwrap_crw(qcrw)
|
||||
v'delete annot_id_uuid_map[crw_]'
|
||||
if found_highlight_to_remove:
|
||||
# have to remove selection otherwise selection bar does
|
||||
# not hide itself on multiline selections
|
||||
window.getSelection().removeAllRanges()
|
||||
|
Loading…
x
Reference in New Issue
Block a user