From c99f18eb6296f443028d4279801f593dc2410192 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 25 Jul 2020 22:20:03 +0530 Subject: [PATCH] ... --- src/pyj/read_book/iframe.pyj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj index 8b53287f80..bc607e80e5 100644 --- a/src/pyj/read_book/iframe.pyj +++ b/src/pyj/read_book/iframe.pyj @@ -769,9 +769,11 @@ class IframeBoss: if crw_: unwrap_crw(crw_) v'delete annot_id_uuid_map[crw_]' - # have to remove selection otherwise it remains as the empty - # string, and the selection bar does not hide itself - window.getSelection().removeAllRanges() + sel = window.getSelection() + if not sel.toString(): + # have to remove selection otherwise it remains as the empty + # string, and the selection bar does not hide itself + sel.removeAllRanges() elif data.type is 'apply-highlight': sel = window.getSelection() text = sel.toString()