auto create preview when modified (and enabled)
This commit is contained in:
@ -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
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# DuckDuckGo - The Search engine you'll fall in love with
|
# DuckDuckGo - The Search engine you'll fall in love with
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
this is a test
|
this is a test
|
||||||
|
|
||||||
hello world...
|
hello world...
|
||||||
Reference in New Issue
Block a user