fix loading 404 from resource

This commit is contained in:
Mathieu PATUREL
2017-01-06 18:49:13 +11:00
parent 76d56deff6
commit 057f770859
7 changed files with 23 additions and 10 deletions

View File

@ -16,6 +16,7 @@ __folder__ = os.path.dirname(__file__)
STYLE_FILE = os.path.join(os.path.dirname(__folder__), 'User',
'MarkdownLivePreview.css')
def plugin_loaded():
global DEFAULT_STYLE_FILE
DEFAULT_STYLE_FILE = sublime.load_resource('Packages/MarkdownLivePreview/'
@ -98,10 +99,6 @@ def hide_preview(view):
sublime.set_timeout(preview.close(), 250)
def get_style():
if os.path.exists(STYLE_FILE):
with open(STYLE_FILE) as fp:
return fp.read()
content = ''.join([line.strip() for line in DEFAULT_STYLE_FILE.splitlines()])
return content + "pre code .space {color: var(--light-bg)}"
@ -134,6 +131,8 @@ def show_html(md_view, preview):
# set viewport position
# sublime.set_clipboard(html)
return
# 0 < y < 1
y = md_view.text_to_layout(md_view.sel()[0].begin())[1] / md_view.layout_extent()[1]