mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix multi-wrap when editing existing highlight
This commit is contained in:
parent
c99f18eb62
commit
8cbb068b04
@ -783,10 +783,8 @@ class IframeBoss:
|
|||||||
annot_id, intersecting_wrappers = wrap_text_in_range(data.style, None, self.add_highlight_listeners)
|
annot_id, intersecting_wrappers = wrap_text_in_range(data.style, None, self.add_highlight_listeners)
|
||||||
removed_highlights = v'[]'
|
removed_highlights = v'[]'
|
||||||
if annot_id is not None:
|
if annot_id is not None:
|
||||||
intersecting_uuids = [annot_id_uuid_map[x] for x in intersecting_wrappers]
|
intersecting_uuids = {annot_id_uuid_map[x]:True for x in intersecting_wrappers}
|
||||||
if data.existing and intersecting_uuids.indexOf(data.existing) > -1:
|
if data.existing and intersecting_uuids[data.existing]:
|
||||||
idx = intersecting_uuids.indexOf(data.existing)
|
|
||||||
intersecting_wrappers.splice(idx, 1)
|
|
||||||
data.uuid = data.existing
|
data.uuid = data.existing
|
||||||
elif intersecting_wrappers.length is 1 and annot_id_uuid_map[intersecting_wrappers[0]]:
|
elif intersecting_wrappers.length is 1 and annot_id_uuid_map[intersecting_wrappers[0]]:
|
||||||
data.uuid = annot_id_uuid_map[intersecting_wrappers[0]]
|
data.uuid = annot_id_uuid_map[intersecting_wrappers[0]]
|
||||||
@ -794,7 +792,7 @@ class IframeBoss:
|
|||||||
removed_highlights = {}
|
removed_highlights = {}
|
||||||
for crw in intersecting_wrappers:
|
for crw in intersecting_wrappers:
|
||||||
unwrap_crw(crw)
|
unwrap_crw(crw)
|
||||||
if annot_id_uuid_map[crw]:
|
if annot_id_uuid_map[crw] and annot_id_uuid_map[crw] is not data.uuid:
|
||||||
removed_highlights[annot_id_uuid_map[crw]] = True
|
removed_highlights[annot_id_uuid_map[crw]] = True
|
||||||
v'delete annot_id_uuid_map[crw]'
|
v'delete annot_id_uuid_map[crw]'
|
||||||
removed_highlights = Object.keys(removed_highlights)
|
removed_highlights = Object.keys(removed_highlights)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user