File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ """
2+ This module contains a plugin that is able to render the html preview of
3+ the current editor.
4+ """
5+ from PyQt5 import QtGui , QtCore
6+ from pyqode .core .widgets import HtmlPreviewWidget
7+
8+ from hackedit import api
9+
10+
11+ class HtmlPreview (api .plugins .WorkspacePlugin ):
12+ def activate (self ):
13+ self .preview = HtmlPreviewWidget ()
14+ self ._dock = api .window .add_dock_widget (
15+ self .preview , 'Preview' , icon = QtGui .QIcon .fromTheme (
16+ 'internet-web-browser' ), area = QtCore .Qt .RightDockWidgetArea )
17+ api .signals .connect_slot (api .signals .CURRENT_EDITOR_CHANGED ,
18+ self .preview .set_editor )
19+ self .preview .hide_requested .connect (self ._dock .hide )
20+ self .preview .show_requested .connect (self ._dock .show )
21+ self .preview .set_editor (None )
22+ self ._dock .hide ()
Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ def run_tests(self):
104104 'FindReplace = hackedit.plugins.find_replace:FindReplace' ,
105105 'DocumentOutline = hackedit.plugins.outline:DocumentOutline' ,
106106 'OpenDocuments = hackedit.plugins.documents:OpenDocuments' ,
107+ 'HtmlPreview = hackedit.plugins.html_preview:HtmlPreview'
107108 ],
108109 'hackedit.plugins.workspace_providers' : [
109110 'generic_workspace = hackedit.plugins.workspaces:GenericWorkspace' ,
You can’t perform that action at this time.
0 commit comments