Clean up deprecated code and fix multiple issues
- Remove deprecated markdown_preview plugin and re-wrote - Renamed alt_provider.py under words completer - Fix words completion provider logic and cache handling - Fix container orientations (VERTICAL -> HORIZONTAL) and add Separators - Remove unused Gtk imports from search_replace plugin - Fix event creation parameter order in source_file.py - Fix typo in source_view.py (_load_pretify_json -> _load_prettify_json) - Refactor webkit_ui with new load methods and enhanced settings
This commit is contained in:
56
plugins/code/markdown_preview/plugin.py
Normal file
56
plugins/code/markdown_preview/plugin.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# Python imports
|
||||
|
||||
# Lib imports
|
||||
|
||||
# Application imports
|
||||
from libs.event_factory import Event_Factory, Code_Event_Types
|
||||
|
||||
from plugins.plugin_types import PluginCode
|
||||
|
||||
from .markdown_preview import MarkdownPreview
|
||||
|
||||
|
||||
|
||||
markdown_preview = MarkdownPreview()
|
||||
|
||||
|
||||
|
||||
class Plugin(PluginCode):
|
||||
def __init__(self):
|
||||
super(Plugin, self).__init__()
|
||||
|
||||
|
||||
def _controller_message(self, event: Code_Event_Types.CodeEvent):
|
||||
if isinstance(event, Code_Event_Types.FocusedViewEvent):
|
||||
markdown_preview._do_markdown_translate(event.view.get_buffer())
|
||||
elif isinstance(event, Code_Event_Types.TextChangedEvent):
|
||||
markdown_preview._do_markdown_translate(event.buffer)
|
||||
|
||||
def load(self):
|
||||
separator_right = self.requests_ui_element("separator-right")
|
||||
markdown_preview.set_relative_to(separator_right)
|
||||
|
||||
event = Event_Factory.create_event("register_command",
|
||||
command_name = "tggle_markdown_preview",
|
||||
command = Handler,
|
||||
binding_mode = "released",
|
||||
binding = "<Shift><Control>m"
|
||||
)
|
||||
|
||||
self.message_to("source_views", event)
|
||||
|
||||
def run(self):
|
||||
...
|
||||
|
||||
|
||||
class Handler:
|
||||
@staticmethod
|
||||
def execute(
|
||||
view: any
|
||||
):
|
||||
logger.debug("Command: Markdown Preview")
|
||||
|
||||
if not markdown_preview.can_hide:
|
||||
markdown_preview.can_hide = True
|
||||
|
||||
markdown_preview.popdown() if markdown_preview.is_visible() else markdown_preview.popup()
|
||||
Reference in New Issue
Block a user