diff --git a/.sublime/MarkdownLivePreview.sublime-commands b/.sublime/MarkdownLivePreview.sublime-commands index 159a5e4..effb64e 100644 --- a/.sublime/MarkdownLivePreview.sublime-commands +++ b/.sublime/MarkdownLivePreview.sublime-commands @@ -2,5 +2,9 @@ { "caption": "MarkdownLivePreview: Edit Current File", "command": "new_markdown_live_preview" + }, + { + "caption": "MarkdownLivePreview: Clear Cache", + "command": "markdown_live_preview_clear_cache" } ] diff --git a/MLPApi.py b/MLPApi.py index a0bec98..fa84499 100644 --- a/MLPApi.py +++ b/MLPApi.py @@ -10,17 +10,18 @@ from .lib import markdown2 as md2 from .escape_amp import * from .functions import * from .setting_names import * +from .image_manager import CACHE_FILE __folder__ = os.path.dirname(__file__) STYLE_FILE = os.path.join(os.path.dirname(__folder__), 'User', - 'MarkdownLivePreview.css') + 'MarkdownLivePreview.css') def plugin_loaded(): global DEFAULT_STYLE_FILE DEFAULT_STYLE_FILE = sublime.load_resource('Packages/MarkdownLivePreview/' - 'default.css') + 'default.css') def get_preview_name(md_view): file_name = md_view.file_name() @@ -82,3 +83,7 @@ def show_html(md_view, preview): vector[1] = mini(vector[1], 0) vector[1] += preview.line_height() preview.set_viewport_position(vector, animate=False) + +def clear_cache(): + """Removes the cache file""" + os.remove(CACHE_FILE) diff --git a/MarkdownLivePreview.py b/MarkdownLivePreview.py index ab4c88d..49f79ee 100644 --- a/MarkdownLivePreview.py +++ b/MarkdownLivePreview.py @@ -89,3 +89,9 @@ class MarkdownLivePreviewListener(sublime_plugin.EventListener): window.set_sidebar_visible(show_sidebar) if show_menus is not None: window.set_menu_visible(show_menus) + + +class MarkdownLivePreviewClearCacheCommand(sublime_plugin.ApplicationCommand): + + def run(self): + clear_cache() diff --git a/MarkdownLivePreview.tasks b/MarkdownLivePreview.tasks index 3918bba..00cee7e 100644 --- a/MarkdownLivePreview.tasks +++ b/MarkdownLivePreview.tasks @@ -2,7 +2,6 @@ Fast: ☐ sync scroll @needsUpdate(because of images) ☐ cache image in object when used, so that it's faster @needsTest - ☐ call settings listener on_new too - might be too heavy ☐ add clear cache command ☐ update README for settings in view @@ -22,6 +21,7 @@ Unknown: ___________________ Archive: + ✘ call settings listener on_new too - might be too heavy @cancelled Sun 08 Jan 2017 at 19:33 @project(Fast) ✔ fix relative source @done Sun 08 Jan 2017 at 19:22 @project(Medium) ✔ add settings for the preview @done Sun 08 Jan 2017 at 17:36 @project(Fast) ✔ regive focus to the right markdown view @done Mon 02 Jan 2017 at 18:34 @project(Fast)