Add tab.set_open_target
This fixes :follow-selected
This commit is contained in:
parent
5dd4b2d56a
commit
1148184892
@ -1113,7 +1113,7 @@ class CommandDispatcher:
|
||||
if QWebSettings.globalSettings().testAttribute(
|
||||
QWebSettings.JavascriptEnabled):
|
||||
if tab:
|
||||
page.open_target = usertypes.ClickTarget.tab
|
||||
widget.set_open_target(usertypes.ClickTarget.tab)
|
||||
widget.run_js_async(
|
||||
'window.getSelection().anchorNode.parentNode.click()')
|
||||
else:
|
||||
|
@ -462,6 +462,10 @@ class AbstractTab(QWidget):
|
||||
def icon(self):
|
||||
raise NotImplementedError
|
||||
|
||||
def set_open_target(self, target):
|
||||
"""Select where the next navigation request should open."""
|
||||
raise NotImplementedError
|
||||
|
||||
def __repr__(self):
|
||||
url = utils.elide(self.cur_url.toDisplayString(QUrl.EncodeUnicode),
|
||||
100)
|
||||
|
@ -155,6 +155,9 @@ class WebEngineViewTab(tab.AbstractTab):
|
||||
def icon(self):
|
||||
return self._widget.icon()
|
||||
|
||||
def set_open_target(self, target):
|
||||
raise NotImplementedError
|
||||
|
||||
def _connect_signals(self):
|
||||
view = self._widget
|
||||
page = view.page()
|
||||
|
@ -464,6 +464,9 @@ class WebViewTab(tab.AbstractTab):
|
||||
def title(self):
|
||||
return self._widget.title()
|
||||
|
||||
def set_open_target(self, target):
|
||||
self._widget.page().open_target = target
|
||||
|
||||
def _connect_signals(self):
|
||||
view = self._widget
|
||||
page = view.page()
|
||||
|
Loading…
Reference in New Issue
Block a user