add clear cache command

This commit is contained in:
Mathieu PATUREL
2017-01-09 12:04:12 +11:00
parent ded9c28096
commit ff8c94bda5
4 changed files with 18 additions and 3 deletions

View File

@ -2,5 +2,9 @@
{
"caption": "MarkdownLivePreview: Edit Current File",
"command": "new_markdown_live_preview"
},
{
"caption": "MarkdownLivePreview: Clear Cache",
"command": "markdown_live_preview_clear_cache"
}
]

View File

@ -10,6 +10,7 @@ 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__)
@ -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)

View File

@ -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()

View File

@ -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)