Merge remote-tracking branch 'origin/pr/3563'
This commit is contained in:
commit
92bc61d08d
@ -803,7 +803,7 @@ class AbstractTab(QWidget):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def dump_async(self, callback, *, plain=False):
|
def dump_async(self, callback, *, plain=False):
|
||||||
"""Dump the current page to a file ascync.
|
"""Dump the current page's html asynchronously.
|
||||||
|
|
||||||
The given callback will be called with the result when dumping is
|
The given callback will be called with the result when dumping is
|
||||||
complete.
|
complete.
|
||||||
|
@ -1507,8 +1507,11 @@ class CommandDispatcher:
|
|||||||
)
|
)
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||||
def view_source(self):
|
def view_source(self, edit=False):
|
||||||
"""Show the source of the current page in a new tab."""
|
"""Show the source of the current page in a new tab.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
edit: Open source in editor instead of tab."""
|
||||||
tab = self._current_widget()
|
tab = self._current_widget()
|
||||||
try:
|
try:
|
||||||
current_url = self._current_url()
|
current_url = self._current_url()
|
||||||
@ -1518,6 +1521,10 @@ class CommandDispatcher:
|
|||||||
if current_url.scheme() == 'view-source':
|
if current_url.scheme() == 'view-source':
|
||||||
raise cmdexc.CommandError("Already viewing source!")
|
raise cmdexc.CommandError("Already viewing source!")
|
||||||
|
|
||||||
|
if edit:
|
||||||
|
ed = editor.ExternalEditor(self._tabbed_browser)
|
||||||
|
tab.dump_async(ed.edit)
|
||||||
|
else:
|
||||||
tab.action.show_source()
|
tab.action.show_source()
|
||||||
|
|
||||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||||
|
Loading…
Reference in New Issue
Block a user