mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-12 02:09:05 +00:00
Delay the initialization of the MarkdownViewer
This commit is contained in:
@@ -31,6 +31,7 @@ namespace QuickLook.Plugin.MarkdownViewer;
|
|||||||
|
|
||||||
public class Plugin : IViewer
|
public class Plugin : IViewer
|
||||||
{
|
{
|
||||||
|
private bool _isInitialized = false;
|
||||||
private WebpagePanel? _panel;
|
private WebpagePanel? _panel;
|
||||||
private string? _currentHtmlPath;
|
private string? _currentHtmlPath;
|
||||||
|
|
||||||
@@ -58,6 +59,12 @@ public class Plugin : IViewer
|
|||||||
public int Priority => 0;
|
public int Priority => 0;
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
|
{
|
||||||
|
// Delayed initialization can speed up startup
|
||||||
|
_isInitialized = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InitializeResources()
|
||||||
{
|
{
|
||||||
// Initialize resources and handle versioning
|
// Initialize resources and handle versioning
|
||||||
_resourceManager.InitializeResources();
|
_resourceManager.InitializeResources();
|
||||||
@@ -78,6 +85,12 @@ public class Plugin : IViewer
|
|||||||
|
|
||||||
public void View(string path, ContextObject context)
|
public void View(string path, ContextObject context)
|
||||||
{
|
{
|
||||||
|
if (!_isInitialized)
|
||||||
|
{
|
||||||
|
_isInitialized = true;
|
||||||
|
InitializeResources();
|
||||||
|
}
|
||||||
|
|
||||||
_panel = new WebpagePanel();
|
_panel = new WebpagePanel();
|
||||||
context.ViewerContent = _panel;
|
context.ViewerContent = _panel;
|
||||||
context.Title = Path.GetFileName(path);
|
context.Title = Path.GetFileName(path);
|
||||||
|
Reference in New Issue
Block a user