mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Viewer: Fix error when scrolling to some search results in flow mode. Fixes #1908000 [calibre viewer shows "Unhandled error: Uncaught InvalidStateError: Failed to execute 'surroundContents' on 'Range'" after RegExp searching in epub-file](https://bugs.launchpad.net/calibre/+bug/1908000)
This commit is contained in:
parent
26998b0a59
commit
47b4530a56
@ -94,7 +94,11 @@ def select_crw(crw):
|
||||
|
||||
|
||||
def wrap_range(r, wrapper):
|
||||
r.surroundContents(wrapper)
|
||||
try:
|
||||
r.surroundContents(wrapper)
|
||||
except:
|
||||
wrapper.appendChild(r.extractContents())
|
||||
r.insertNode(wrapper)
|
||||
# remove any empty text nodes created by surroundContents() on either
|
||||
# side of the wrapper. This happens for instance on Chrome when
|
||||
# wrapping all text inside <i>some text</i>
|
||||
|
Loading…
x
Reference in New Issue
Block a user