Add cross-plugin 'Reopen as' menu for SVG and HTML

Introduces 'Reopen as source code' and 'Reopen as image preview' options in the MoreMenu for SVG and HTML files, enabling users to switch between ImageViewer and TextViewer plugins. Updates translation files to support new menu items in multiple languages and refactors related plugin code for extensibility.
This commit is contained in:
ema
2025-10-08 01:54:12 +08:00
parent f7c029f127
commit 432b3b033a
9 changed files with 193 additions and 32 deletions

View File

@@ -17,6 +17,7 @@
using QuickLook.Common.Helpers;
using QuickLook.Common.Plugin;
using QuickLook.Common.Plugin.MoreMenu;
using QuickLook.Plugin.ImageViewer.AnimatedImage.Providers;
using QuickLook.Plugin.ImageViewer.Webview;
using System;
@@ -28,7 +29,7 @@ using System.Windows.Input;
namespace QuickLook.Plugin.ImageViewer;
public class Plugin : IViewer
public partial class Plugin : IViewer, IMoreMenu
{
private static readonly HashSet<string> WellKnownExtensions = new(
[
@@ -56,6 +57,7 @@ public class Plugin : IViewer
]);
private ImagePanel _ip;
private string _currentPath;
private MetaProvider _meta;
private IWebImagePanel _ipWeb;
@@ -63,6 +65,8 @@ public class Plugin : IViewer
public int Priority => 0;
public IEnumerable<IMenuItem> MenuItems => GetMenuItems();
public void Init()
{
// Option of UseColorProfile:
@@ -137,6 +141,8 @@ public class Plugin : IViewer
public void View(string path, ContextObject context)
{
_currentPath = path;
if (WebHandler.TryView(path, context, _metaWeb, out _ipWeb))
return;