mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix preview not scrolling to anchor when clicking an internal link to another html file in the book
This commit is contained in:
parent
92fe190f63
commit
c9b2578b33
@ -1261,7 +1261,7 @@ class Boss(QObject):
|
||||
editor = self.edit_file(name, syntax)
|
||||
if anchor and editor is not None:
|
||||
if editor.go_to_anchor(anchor):
|
||||
self.gui.preview.go_to_anchor(anchor)
|
||||
self.gui.preview.pending_go_to_anchor = anchor
|
||||
elif show_anchor_not_found:
|
||||
error_dialog(self.gui, _('Not found'), _(
|
||||
'The anchor %s was not found in this file') % anchor, show=True)
|
||||
|
@ -403,6 +403,7 @@ class Preview(QWidget):
|
||||
self.view._page.bridge.request_sync.connect(self.request_sync)
|
||||
self.view._page.bridge.request_split.connect(self.request_split)
|
||||
self.view._page.loadFinished.connect(self.load_finished)
|
||||
self.pending_go_to_anchor = None
|
||||
self.inspector = self.view.inspector
|
||||
l.addWidget(self.view)
|
||||
self.bar = QToolBar(self)
|
||||
@ -603,6 +604,9 @@ class Preview(QWidget):
|
||||
actions['split-in-preview'].setChecked(False)
|
||||
|
||||
def load_finished(self, ok):
|
||||
if self.pending_go_to_anchor:
|
||||
self.view._page.go_to_anchor(self.pending_go_to_anchor)
|
||||
self.pending_go_to_anchor = None
|
||||
if actions['split-in-preview'].isChecked():
|
||||
if ok:
|
||||
self.do_start_split()
|
||||
|
Loading…
x
Reference in New Issue
Block a user