mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-10-20 10:43:28 +00:00
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:
@@ -21,33 +21,21 @@ using QuickLook.Common.Plugin.MoreMenu;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace QuickLook.Plugin.HtmlViewer;
|
||||
|
||||
public partial class Plugin
|
||||
{
|
||||
public ICommand ViewSourceCodeCommand { get; }
|
||||
|
||||
public Plugin()
|
||||
{
|
||||
ViewSourceCodeCommand = new RelayCommand(ViewSourceCode);
|
||||
}
|
||||
|
||||
public IEnumerable<IMenuItem> GetMenuItems()
|
||||
{
|
||||
string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
|
||||
|
||||
// HTML <=> HTML TEXT
|
||||
yield return new MoreMenuItem()
|
||||
{
|
||||
Icon = "\uE943",
|
||||
Header = TranslationHelper.Get("MW_ReopenAsSourceCode", translationFile),
|
||||
Command = ViewSourceCodeCommand,
|
||||
Command = new RelayCommand(() => PluginHelper.InvokePluginPreview("QuickLook.Plugin.TextViewer", _currentPath)),
|
||||
};
|
||||
}
|
||||
|
||||
public void ViewSourceCode()
|
||||
{
|
||||
PluginHelper.InvokePluginPreview("QuickLook.Plugin.TextViewer", _currentPath);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user