Delay the initialization of the MarkdownViewer

This commit is contained in:
ema
2025-05-10 08:28:16 +08:00
parent d51c8bb25e
commit 5bf422a17f

View File

@@ -31,6 +31,7 @@ namespace QuickLook.Plugin.MarkdownViewer;
public class Plugin : IViewer
{
private bool _isInitialized = false;
private WebpagePanel? _panel;
private string? _currentHtmlPath;
@@ -58,6 +59,12 @@ public class Plugin : IViewer
public int Priority => 0;
public void Init()
{
// Delayed initialization can speed up startup
_isInitialized = false;
}
public void InitializeResources()
{
// Initialize resources and handle versioning
_resourceManager.InitializeResources();
@@ -78,6 +85,12 @@ public class Plugin : IViewer
public void View(string path, ContextObject context)
{
if (!_isInitialized)
{
_isInitialized = true;
InitializeResources();
}
_panel = new WebpagePanel();
context.ViewerContent = _panel;
context.Title = Path.GetFileName(path);