mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-10-18 01:17:04 +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,19 +21,11 @@ using QuickLook.Common.Plugin.MoreMenu;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace QuickLook.Plugin.TextViewer;
|
||||
|
||||
public partial class Plugin
|
||||
{
|
||||
public ICommand ReopenAsHtmlPreviewCommand { get; }
|
||||
|
||||
public Plugin()
|
||||
{
|
||||
ReopenAsHtmlPreviewCommand = new RelayCommand(ReopenAsHtmlPreview);
|
||||
}
|
||||
|
||||
public IEnumerable<IMenuItem> GetMenuItems()
|
||||
{
|
||||
string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
|
||||
@@ -41,23 +33,27 @@ public partial class Plugin
|
||||
|
||||
var reopen = extension switch
|
||||
{
|
||||
// HTML <=> HTML TEXT
|
||||
// \QuickLook\QuickLook.Plugin\QuickLook.Plugin.TextViewer\Syntax\Light\zzz-After-JavaScript-HTML.xshd
|
||||
// .html;.htm;.xhtml;.shtml;.shtm;.xht;.hta
|
||||
".html" or ".htm" or ".xhtml" or ".shtml" or ".shtm" or ".xht" or ".hta" => new MoreMenuItem()
|
||||
{
|
||||
Icon = "\uE774",
|
||||
Header = TranslationHelper.Get("MW_ReopenAsHtmlPreview", translationFile),
|
||||
Command = ReopenAsHtmlPreviewCommand,
|
||||
Command = new RelayCommand(() => PluginHelper.InvokePluginPreview("QuickLook.Plugin.HtmlViewer", _currentPath)),
|
||||
},
|
||||
_ => null
|
||||
|
||||
// SVG IMAGE <=> XML TEXT
|
||||
".svg" => new MoreMenuItem()
|
||||
{
|
||||
Icon = "\uE774",
|
||||
Header = TranslationHelper.Get("MW_ReopenAsImagePreview", translationFile),
|
||||
Command = new RelayCommand(() => PluginHelper.InvokePluginPreview("QuickLook.Plugin.ImageViewer", _currentPath)),
|
||||
},
|
||||
_ => null,
|
||||
};
|
||||
|
||||
if (reopen is not null)
|
||||
yield return reopen;
|
||||
}
|
||||
|
||||
public void ReopenAsHtmlPreview()
|
||||
{
|
||||
PluginHelper.InvokePluginPreview("QuickLook.Plugin.HtmlViewer", _currentPath);
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.syn;.lang;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.resx;.user;.ilproj;.booproj;.build;.xfrm;.targets;.axaml;.xaml;.xpt;.xft;.map;.wsdl;.disco;.ascx;.atom;.bpmn;.cpt;.csl;.props;.dotsettings;.slnx">
|
||||
<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.syn;.lang;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.resx;.user;.ilproj;.booproj;.build;.xfrm;.targets;.axaml;.xaml;.xpt;.xft;.map;.wsdl;.disco;.ascx;.atom;.bpmn;.cpt;.csl;.props;.dotsettings;.slnx;.svg">
|
||||
|
||||
<Environment>
|
||||
<Default color="#D4D4D4" bgcolor="#1E1E1E"/>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.syn;.lang;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.resx;.user;.ilproj;.booproj;.build;.xfrm;.targets;.axaml;.xaml;.xpt;.xft;.map;.wsdl;.disco;.ascx;.atom;.bpmn;.cpt;.csl;.props;.dotsettings;.slnx">
|
||||
<SyntaxDefinition name="XML" extensions=".xml;.xsl;.xslt;.xsd;.syn;.lang;.manifest;.config;.addin;.xshd;.wxs;.wxi;.wxl;.proj;.csproj;.vbproj;.resx;.user;.ilproj;.booproj;.build;.xfrm;.targets;.axaml;.xaml;.xpt;.xft;.map;.wsdl;.disco;.ascx;.atom;.bpmn;.cpt;.csl;.props;.dotsettings;.slnx;.svg">
|
||||
|
||||
<Environment>
|
||||
<Default color="Black" bgcolor="#FFFFFF"/>
|
||||
|
@@ -6,167 +6,195 @@
|
||||
<Editor_Copy>انسخ</Editor_Copy>
|
||||
<Editor_SelectAll>حدد الكل</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>إعادة فتح كمعاينة HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>إعادة فتح كمعاينة صورة</MW_ReopenAsImagePreview>
|
||||
</ar>
|
||||
<ca>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Copia</Editor_Copy>
|
||||
<Editor_SelectAll>Selecciona-ho tot</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Torna a obrir com a previsualització HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Torna a obrir com a previsualització d'imatge</MW_ReopenAsImagePreview>
|
||||
</ca>
|
||||
<de>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Kopieren</Editor_Copy>
|
||||
<Editor_SelectAll>Alles markieren</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Als HTML-Vorschau erneut öffnen</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Als Bildvorschau erneut öffnen</MW_ReopenAsImagePreview>
|
||||
</de>
|
||||
<en>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Copy</Editor_Copy>
|
||||
<Editor_SelectAll>Select All</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Reopen as HTML preview</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Reopen as image preview</MW_ReopenAsImagePreview>
|
||||
</en>
|
||||
<es>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Copiar</Editor_Copy>
|
||||
<Editor_SelectAll>Seleccionar Todo</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Reabrir como vista previa HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Reabrir como vista previa de imagen</MW_ReopenAsImagePreview>
|
||||
</es>
|
||||
<fr>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Copie</Editor_Copy>
|
||||
<Editor_SelectAll>Tout sélectionner</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Rouvrir en aperçu HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Rouvrir en aperçu d'image</MW_ReopenAsImagePreview>
|
||||
</fr>
|
||||
<it>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Copia</Editor_Copy>
|
||||
<Editor_SelectAll>Seleziona tutto</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Riapri come anteprima HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Riapri come anteprima immagine</MW_ReopenAsImagePreview>
|
||||
</it>
|
||||
<ja-JP>
|
||||
<Editor_FontFamily>Consolas,Meiryo UI,MS UI Gothic,MS Gothic</Editor_FontFamily>
|
||||
<Editor_Copy>コピー</Editor_Copy>
|
||||
<Editor_SelectAll>すべて選択</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>HTML プレビューとして再度開く</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>画像プレビューとして再度開く</MW_ReopenAsImagePreview>
|
||||
</ja-JP>
|
||||
<ko>
|
||||
<Editor_FontFamily>Consolas,Malgun Gothic,Gulim</Editor_FontFamily>
|
||||
<Editor_Copy>복사</Editor_Copy>
|
||||
<Editor_SelectAll>모두 선택</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>HTML 미리보기로 다시 열기</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>이미지 미리보기로 다시 열기</MW_ReopenAsImagePreview>
|
||||
</ko>
|
||||
<nb-NO>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Kopier</Editor_Copy>
|
||||
<Editor_SelectAll>Merk alt</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Åpne på nytt som HTML-forhåndsvisning</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Åpne på nytt som bilde-forhåndsvisning</MW_ReopenAsImagePreview>
|
||||
</nb-NO>
|
||||
<nl-NL>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Kopiëren</Editor_Copy>
|
||||
<Editor_SelectAll>Alles selecteren</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Opnieuw openen als HTML-voorbeeld</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Opnieuw openen als afbeelding-voorbeeld</MW_ReopenAsImagePreview>
|
||||
</nl-NL>
|
||||
<pl>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Kopiuj</Editor_Copy>
|
||||
<Editor_SelectAll>Zaznacz wszystko</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Otwórz ponownie jako podgląd HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Otwórz ponownie jako podgląd obrazu</MW_ReopenAsImagePreview>
|
||||
</pl>
|
||||
<pt-BR>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Copiar</Editor_Copy>
|
||||
<Editor_SelectAll>Selecionar tudo</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Reabrir como visualização HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Reabrir como visualização de imagem</MW_ReopenAsImagePreview>
|
||||
</pt-BR>
|
||||
<pt-PT>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Copiar</Editor_Copy>
|
||||
<Editor_SelectAll>Selecionar tudo</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Reabrir como pré-visualização HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Reabrir como pré-visualização de imagem</MW_ReopenAsImagePreview>
|
||||
</pt-PT>
|
||||
<ru-RU>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Копировать</Editor_Copy>
|
||||
<Editor_SelectAll>Выделить всё</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Переоткрыть как предварительный просмотр HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Переоткрыть как предварительный просмотр изображения</MW_ReopenAsImagePreview>
|
||||
</ru-RU>
|
||||
<tr-TR>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Kopyala</Editor_Copy>
|
||||
<Editor_SelectAll>Tümünü seç</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>HTML önizlemesi olarak yeniden aç</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Resim önizlemesi olarak yeniden aç</MW_ReopenAsImagePreview>
|
||||
</tr-TR>
|
||||
<uk-UA>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Копіювати</Editor_Copy>
|
||||
<Editor_SelectAll>Виділити Все</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Перевідкрити як попередній перегляд HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Перевідкрити як попередній перегляд зображення</MW_ReopenAsImagePreview>
|
||||
</uk-UA>
|
||||
<vi>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Sao chép</Editor_Copy>
|
||||
<Editor_SelectAll>Chọn tất cả</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Mở lại dưới dạng xem trước HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Mở lại dưới dạng xem trước hình ảnh</MW_ReopenAsImagePreview>
|
||||
</vi>
|
||||
<zh-CN>
|
||||
<Editor_FontFamily>Consolas,Microsoft Yahei UI,Microsoft Yahei,SimSun</Editor_FontFamily>
|
||||
<Editor_Copy>复制</Editor_Copy>
|
||||
<Editor_SelectAll>全选</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>重新作为 HTML 预览打开</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>重新作为图像预览打开</MW_ReopenAsImagePreview>
|
||||
</zh-CN>
|
||||
<zh-TW>
|
||||
<Editor_FontFamily>Consolas,Microsoft JhengHei UI,Microsoft JhengHei,MingLiU</Editor_FontFamily>
|
||||
<Editor_Copy>複製</Editor_Copy>
|
||||
<Editor_SelectAll>全選</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>重新作為 HTML 預覽開啟</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>重新作為圖像預覽開啟</MW_ReopenAsImagePreview>
|
||||
</zh-TW>
|
||||
<mr>
|
||||
<Editor_FontFamily>Consolas,Mangal,Nirmala UI</Editor_FontFamily>
|
||||
<Editor_Copy>प्रतिलिपी करा</Editor_Copy>
|
||||
<Editor_SelectAll>सर्व निवडा</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>HTML पूर्वावलोकन म्हणून पुन्हा उघडा</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>प्रतिमा पूर्वावलोकन म्हणून पुन्हा उघडा</MW_ReopenAsImagePreview>
|
||||
</mr>
|
||||
<hi>
|
||||
<Editor_FontFamily>Consolas,Mangal,Nirmala UI</Editor_FontFamily>
|
||||
<Editor_Copy>कॉपी करें</Editor_Copy>
|
||||
<Editor_SelectAll>सभी चुनें</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>HTML पूर्वावलोकन के रूप में फिर से खोलें</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>छवि पूर्वावलोकन के रूप में फिर से खोलें</MW_ReopenAsImagePreview>
|
||||
</hi>
|
||||
<he>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>העתק</Editor_Copy>
|
||||
<Editor_SelectAll>בחר הכל</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>פתח מחדש כתצוגה מקדימה של HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>פתח מחדש כתצוגה מקדימה של תמונה</MW_ReopenAsImagePreview>
|
||||
</he>
|
||||
<hu-HU>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Másolás</Editor_Copy>
|
||||
<Editor_SelectAll>Mindet kijelöl</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Újranyitás HTML előnézetként</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Újranyitás kép előnézetként</MW_ReopenAsImagePreview>
|
||||
</hu-HU>
|
||||
<id-ID>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Salin</Editor_Copy>
|
||||
<Editor_SelectAll>Pilih Semua</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Buka ulang sebagai pratinjau HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Buka ulang sebagai pratinjau gambar</MW_ReopenAsImagePreview>
|
||||
</id-ID>
|
||||
<sk>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Kopírovať</Editor_Copy>
|
||||
<Editor_SelectAll>Označiť všetko</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Znova otvoriť ako HTML náhľad</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Znova otvoriť ako náhľad obrázka</MW_ReopenAsImagePreview>
|
||||
</sk>
|
||||
<el>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Aντιγραφή</Editor_Copy>
|
||||
<Editor_SelectAll>Επιλογή όλων</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Επανανοίξτε ως προεπισκόπηση HTML</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Επανανοίξτε ως προεπισκόπηση εικόνας</MW_ReopenAsImagePreview>
|
||||
</el>
|
||||
<sv>
|
||||
<Editor_FontFamily>Consolas</Editor_FontFamily>
|
||||
<Editor_Copy>Kopiera</Editor_Copy>
|
||||
<Editor_SelectAll>Markera allt</Editor_SelectAll>
|
||||
<MW_ReopenAsHtmlPreview>Öppna på nytt som HTML-förhandsgranskning</MW_ReopenAsHtmlPreview>
|
||||
<MW_ReopenAsImagePreview>Öppna på nytt som bildförhandsgranskning</MW_ReopenAsImagePreview>
|
||||
</sv>
|
||||
</Translations>
|
||||
|
Reference in New Issue
Block a user