diff --git a/src/pyj/read_book/iframe.pyj b/src/pyj/read_book/iframe.pyj
index bebe72b569..869b6506d9 100644
--- a/src/pyj/read_book/iframe.pyj
+++ b/src/pyj/read_book/iframe.pyj
@@ -62,7 +62,7 @@ from read_book.touch import (
create_handlers as create_touch_handlers, reset_handlers as reset_touch_handlers
)
from read_book.viewport import scroll_viewport
-from utils import debounce, html_escape, is_ios
+from utils import debounce, is_ios
FORCE_FLOW_MODE = False
CALIBRE_VERSION = '__CALIBRE_VERSION__'
@@ -707,11 +707,8 @@ class IframeBoss:
if current_layout_mode() is not 'flow':
snap_to_selection()
else:
- if from_load:
- self.send_message('error', title=_('Invisible text'), msg=_(
- 'The text {} is present on this page but not visible').format(html_escape(data.text)))
- else:
- self.send_message('find_in_spine', text=data.text, backwards=data.backwards, searched_in_spine=data.searched_in_spine)
+ msg_type = 'invisible_text' if from_load else 'find_in_spine'
+ self.send_message(msg_type, text=data.text, backwards=data.backwards, searched_in_spine=data.searched_in_spine)
def show_search_result(self, data, from_load):
self.last_search_at = window.performance.now()
diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj
index ec6ee80d50..16613c4679 100644
--- a/src/pyj/read_book/view.pyj
+++ b/src/pyj/read_book/view.pyj
@@ -264,6 +264,7 @@ class View:
'content_loaded': self.on_content_loaded,
'error': self.on_iframe_error,
'find_in_spine': self.on_find_in_spine,
+ 'invisible_text': self.on_invisible_text,
'goto_doc_boundary': def(data): self.goto_doc_boundary(data.start);,
'handle_keypress': self.on_handle_keypress,
'handle_shortcut': self.on_handle_shortcut,
@@ -594,6 +595,13 @@ class View:
def find(self, text, backwards):
self.iframe_wrapper.send_message('find', text=text, backwards=backwards, searched_in_spine=False)
+ def on_invisible_text(self, data):
+ warning_dialog(
+ _('Not found'), _('The text: {} is present on this page but not visible').format(html_escape(data.text)),
+ on_close=def():
+ self.search_overlay.show()
+ )
+
def on_find_in_spine(self, data):
if data.searched_in_spine:
warning_dialog(