mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-11 17:59:17 +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
|
||||
{
|
||||
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);
|
||||
|
Reference in New Issue
Block a user