auto create preview when modified (and enabled)

This commit is contained in:
Mathieu PATUREL
2017-01-04 19:49:49 +11:00
parent 28a7274b05
commit 4a3caf30bb
2 changed files with 10 additions and 2 deletions

View File

@ -11,6 +11,14 @@ from .functions import *
class MarkdownLivePreviewListener(sublime_plugin.EventListener): class MarkdownLivePreviewListener(sublime_plugin.EventListener):
def on_modified(self, view):
window = view.window()
vsettings = view.settings()
if vsettings.get(PREVIEW_ENABLED):
id = vsettings.get(PREVIEW_ID)
if id is None or get_view_from_id(window, id) is None:
preview = create_preview(view)
def on_activated(self, view): def on_activated(self, view):
# if view is md_view and has no preview # if view is md_view and has no preview
# -> create preview # -> create preview