mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Invisible text should not be a fatal error
This commit is contained in:
parent
639c0e1ecc
commit
eecac78739
@ -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 <i>{}</i> 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()
|
||||
|
@ -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: <i>{}</i> 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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user