diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.MoreMenu.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.MoreMenu.cs
new file mode 100644
index 0000000..d03756f
--- /dev/null
+++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.MoreMenu.cs
@@ -0,0 +1,63 @@
+// Copyright © 2017-2025 QL-Win Contributors
+//
+// This file is part of QuickLook program.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+
+using QuickLook.Common.Commands;
+using QuickLook.Common.Helpers;
+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 GetMenuItems()
+ {
+ string translationFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Translations.config");
+ string extension = Path.GetExtension(_currentPath).ToLower();
+
+ var reopen = extension switch
+ {
+ // \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,
+ },
+ _ => null
+ };
+
+ if (reopen is not null)
+ yield return reopen;
+ }
+
+ public void ReopenAsHtmlPreview()
+ {
+ PluginHelper.InvokePluginPreview("QuickLook.Plugin.HtmlViewer", _currentPath);
+ }
+}
diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs
index 9351e52..7489304 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs
+++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Plugin.cs
@@ -16,6 +16,7 @@
// along with this program. If not, see .
using QuickLook.Common.Plugin;
+using QuickLook.Common.Plugin.MoreMenu;
using System;
using System.Collections.Generic;
using System.IO;
@@ -27,7 +28,7 @@ using System.Windows.Media;
namespace QuickLook.Plugin.TextViewer;
-public class Plugin : IViewer
+public partial class Plugin : IViewer, IMoreMenu
{
private static readonly HashSet WellKnownExtensions = new(
[
@@ -35,9 +36,12 @@ public class Plugin : IViewer
]);
private TextViewerPanel _tvp;
+ private string _currentPath;
public int Priority => -5;
+ public IEnumerable MenuItems => GetMenuItems();
+
public void Init()
{
}
@@ -82,6 +86,7 @@ public class Plugin : IViewer
else
{
_tvp = new TextViewerPanel();
+ _currentPath = path;
_tvp.LoadFileAsync(path, context);
context.ViewerContent = _tvp;
}
diff --git a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Translations.config b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Translations.config
index c09344c..1ca9e10 100644
--- a/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Translations.config
+++ b/QuickLook.Plugin/QuickLook.Plugin.TextViewer/Translations.config
@@ -5,145 +5,168 @@
Consolas
انسخ
حدد الكل
+ إعادة فتح كمعاينة HTML
Consolas
Copia
Selecciona-ho tot
+ Torna a obrir com a previsualització HTML
Consolas
Kopieren
Alles markieren
+ Als HTML-Vorschau erneut öffnen
Consolas
Copy
Select All
+ Reopen as HTML preview
-
- Consolas
- انسخ
- حدد الكل
-
Consolas
Copiar
Seleccionar Todo
+ Reabrir como vista previa HTML
Consolas
Copie
Tout sélectionner
+ Rouvrir en aperçu HTML
Consolas
Copia
Seleziona tutto
+ Riapri come anteprima HTML
Consolas,Meiryo UI,MS UI Gothic,MS Gothic
コピー
すべて選択
+ HTML プレビューとして再度開く
Consolas,Malgun Gothic,Gulim
복사
모두 선택
+ HTML 미리보기로 다시 열기
Consolas
Kopier
Merk alt
+ Åpne på nytt som HTML-forhåndsvisning
Consolas
Kopiëren
Alles selecteren
+ Opnieuw openen als HTML-voorbeeld
Consolas
Kopiuj
Zaznacz wszystko
+ Otwórz ponownie jako podgląd HTML
Consolas
Copiar
Selecionar tudo
+ Reabrir como visualização HTML
Consolas
Copiar
Selecionar tudo
+ Reabrir como pré-visualização HTML
Consolas
Копировать
Выделить всё
+ Переоткрыть как предварительный просмотр HTML
Consolas
Kopyala
Tümünü seç
+ HTML önizlemesi olarak yeniden aç
Consolas
Копіювати
Виділити Все
+ Перевідкрити як попередній перегляд HTML
Consolas
Sao chép
Chọn tất cả
+ Mở lại dưới dạng xem trước HTML
Consolas,Microsoft Yahei UI,Microsoft Yahei,SimSun
复制
全选
+ 重新作为 HTML 预览打开
Consolas,Microsoft JhengHei UI,Microsoft JhengHei,MingLiU
複製
全選
+ 重新作為 HTML 預覽開啟
Consolas,Mangal,Nirmala UI
प्रतिलिपी करा
सर्व निवडा
+ HTML पूर्वावलोकन म्हणून पुन्हा उघडा
Consolas,Mangal,Nirmala UI
कॉपी करें
सभी चुनें
+ HTML पूर्वावलोकन के रूप में फिर से खोलें
Consolas
העתק
בחר הכל
+ פתח מחדש כתצוגה מקדימה של HTML
Consolas
Másolás
Mindet kijelöl
+ Újranyitás HTML előnézetként
Consolas
Salin
Pilih Semua
+ Buka ulang sebagai pratinjau HTML
Consolas
Kopírovať
Označiť všetko
+ Znova otvoriť ako HTML náhľad
Consolas
Aντιγραφή
Επιλογή όλων
+ Επανανοίξτε ως προεπισκόπηση HTML
Consolas
Kopiera
Markera allt
+ Öppna på nytt som HTML-förhandsgranskning
diff --git a/QuickLook/ViewerWindow.Actions.cs b/QuickLook/ViewerWindow.Actions.cs
index 1e4a799..db3a85f 100644
--- a/QuickLook/ViewerWindow.Actions.cs
+++ b/QuickLook/ViewerWindow.Actions.cs
@@ -201,30 +201,6 @@ public partial class ViewerWindow
return;
}
- // Initial the more menu
- ClearMoreMenuUnpin();
- foreach (var plugin in
- PluginManager.GetInstance().LoadedPlugins
- .GroupBy(x => x.ToString()).Select(g => g.First()) // DistinctBy plugin name
- .OrderBy(p => p.Priority)) // OrderBy plugin priority
- {
- if (plugin.ToString() == Plugin.ToString())
- {
- if (Plugin is IMoreMenu moreMenu && moreMenu.MenuItems is not null)
- {
- InsertMoreMenu(moreMenu.MenuItems);
- }
- continue;
- }
- else
- {
- if (plugin is IMoreMenuExtended moreMenu && moreMenu.MenuItems is not null)
- {
- InsertMoreMenu(moreMenu.MenuItems);
- }
- }
- }
-
SetOpenWithButtonAndPath();
// Revert UI changes
@@ -263,18 +239,41 @@ public partial class ViewerWindow
}
// Load plugin, do not block UI
- Dispatcher.BeginInvoke(new Action(() =>
+ Dispatcher.BeginInvoke(() =>
{
try
{
Plugin.View(path, ContextObject);
+
+ // Initial the more menu
+ ClearMoreMenuUnpin();
+ foreach (var plugin in
+ PluginManager.GetInstance().LoadedPlugins
+ .GroupBy(x => x.ToString()).Select(g => g.First()) // DistinctBy plugin name
+ .OrderBy(p => p.Priority)) // OrderBy plugin priority
+ {
+ if (plugin.ToString() == Plugin.ToString())
+ {
+ if (Plugin is IMoreMenu moreMenu && moreMenu.MenuItems is not null)
+ {
+ InsertMoreMenu(moreMenu.MenuItems);
+ }
+ continue;
+ }
+ else
+ {
+ if (plugin is IMoreMenuExtended moreMenu && moreMenu.MenuItems is not null)
+ {
+ InsertMoreMenu(moreMenu.MenuItems);
+ }
+ }
+ }
}
catch (Exception e)
{
exceptionHandler(path, ExceptionDispatchInfo.Capture(e));
}
- }),
- DispatcherPriority.Input);
+ }, DispatcherPriority.Input);
}
private void ClearMoreMenuUnpin()