mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
qt/aqt/webview: handle opening href with target=_blank (#1623)
* qt/aqt/webview: handle opening href with target=_blank * CONTRIBUTORS: add username as part of first PR
This commit is contained in:
parent
62fd5b2b42
commit
2c357a6c94
2 changed files with 6 additions and 0 deletions
|
@ -91,6 +91,7 @@ git9527 <github.com/git9527>
|
|||
Vova Selin <vselin12@gmail.com>
|
||||
qxo <49526356@qq.com>
|
||||
Spooghetti420 <github.com/spooghetti420>
|
||||
Danish Prakash <github.com/danishprakash>
|
||||
|
||||
********************
|
||||
|
||||
|
|
|
@ -259,6 +259,11 @@ class AnkiWebView(QWebEngineView):
|
|||
def disable_zoom(self) -> None:
|
||||
self._disable_zoom = True
|
||||
|
||||
def createWindow(self, windowType: QWebEnginePage.WebWindowType) -> QWebEngineView:
|
||||
# intercept opening a new window (hrefs
|
||||
# with target="_blank") and return view
|
||||
return AnkiWebView()
|
||||
|
||||
def eventFilter(self, obj: QObject, evt: QEvent) -> bool:
|
||||
if self._disable_zoom and is_gesture_or_zoom_event(evt):
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue