From e30b7fc36a537ed909d0a2c0cc18871103a9b877 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Sat, 6 Feb 2021 15:03:21 +1000 Subject: [PATCH] handle remote links in ts pages Required to avoid loading remote links embedded in deck descriptions in the webview --- qt/aqt/webview.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index 920a53898..e64fe4050 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -114,7 +114,7 @@ class AnkiWebPage(QWebEnginePage): def acceptNavigationRequest( self, url: QUrl, navType: Any, isMainFrame: bool ) -> bool: - if not self.open_links_externally: + if not self.open_links_externally or "_anki/pages" in url.path(): return super().acceptNavigationRequest(url, navType, isMainFrame) if not isMainFrame: @@ -636,7 +636,7 @@ document.head.appendChild(style); def load_ts_page(self, name: str) -> None: from aqt import mw - self.set_open_links_externally(False) + self.set_open_links_externally(True) if theme_manager.night_mode: extra = "#night" else: