When applying a new highlight over a single existing one, replace it

This commit is contained in:
Kovid Goyal 2020-04-11 09:47:18 +05:30
parent e492c88c9a
commit d61273b7cd
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -664,12 +664,16 @@ class IframeBoss:
unwrap_crw(crw) unwrap_crw(crw)
removed_highlights[self.annot_id_uuid_map[crw]] = True removed_highlights[self.annot_id_uuid_map[crw]] = True
v'delete self.annot_id_uuid_map[crw]' v'delete self.annot_id_uuid_map[crw]'
removed_highlights = Object.keys(removed_highlights)
if removed_highlights.length is 1:
data.uuid = removed_highlights[0]
removed_highlights = v'[]'
self.send_message( self.send_message(
'annotations', 'annotations',
type='highlight-applied', type='highlight-applied',
uuid=data.uuid, ok=annot_id is not None, uuid=data.uuid, ok=annot_id is not None,
bounds=bounds, bounds=bounds,
removed_highlights=Object.keys(removed_highlights), removed_highlights=removed_highlights,
highlighted_text=text, highlighted_text=text,
) )
reset_find_caches() reset_find_caches()