mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-09-06 05:03:17 +00:00
Compare commits
2 Commits
copilot/fi
...
copilot/fi
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4742908983 | ||
![]() |
ccbe1c297a |
@@ -89,7 +89,6 @@
|
||||
Padding="3"
|
||||
FontSize="19"
|
||||
FontWeight="SemiBold"
|
||||
IsTextSelectionEnabled="True"
|
||||
LineHeight="25"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap">
|
||||
@@ -111,7 +110,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap" />
|
||||
|
@@ -84,7 +84,6 @@
|
||||
Padding="3"
|
||||
FontSize="19"
|
||||
FontWeight="SemiBold"
|
||||
IsTextSelectionEnabled="True"
|
||||
LineHeight="25"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap">
|
||||
@@ -106,7 +105,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap" />
|
||||
@@ -123,7 +121,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap" />
|
||||
@@ -140,7 +137,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap" />
|
||||
@@ -157,7 +153,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Calculating size..." />
|
||||
<!-- Last Modified -->
|
||||
<TextBlock x:Name="modDateTitle"
|
||||
@@ -172,7 +167,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<!-- Capabilities -->
|
||||
|
@@ -110,7 +110,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap" />
|
||||
|
@@ -98,7 +98,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap" />
|
||||
|
@@ -59,7 +59,7 @@
|
||||
<PackageReference Include="QuickLook.ImageGlass.WebP" Version="1.4.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.7.0">
|
||||
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="14.6.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3351.48">
|
||||
|
@@ -16,12 +16,10 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using QuickLook.Common.Helpers;
|
||||
using QuickLook.Plugin.HtmlViewer;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -80,21 +78,7 @@ public class MarkdownPanel : WebpagePanel
|
||||
var content = encoding.GetString(bytes);
|
||||
|
||||
var template = ReadString("/md2html.html");
|
||||
|
||||
// Support automatic RTL for markdown files
|
||||
bool isRtl = false;
|
||||
if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft)
|
||||
{
|
||||
string isSupportRTL = TranslationHelper.Get("IsSupportRTL",
|
||||
failsafe: bool.TrueString,
|
||||
domain: Assembly.GetExecutingAssembly().GetName().Name);
|
||||
|
||||
if (bool.TrueString.Equals(isSupportRTL, StringComparison.OrdinalIgnoreCase))
|
||||
isRtl = true;
|
||||
}
|
||||
|
||||
var html = template.Replace("{{content}}", content)
|
||||
.Replace("{{rtl}}", isRtl ? "rtl" : "ltr");
|
||||
var html = template.Replace("{{content}}", content);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html dir="{{rtl}}">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
|
||||
@@ -144,34 +144,6 @@
|
||||
cursor: ew-resize;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
/* RTL support */
|
||||
html[dir="rtl"] .container {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
|
||||
html[dir="rtl"] #toc {
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .table-of-contents a {
|
||||
border-right: 2px solid transparent;
|
||||
border-left: none;
|
||||
margin-right: -1em;
|
||||
margin-left: 0;
|
||||
padding-right: calc(1em - 2px);
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .table-of-contents .active {
|
||||
border-right: 2px solid var(--fgColor-accent);
|
||||
border-left: none;
|
||||
margin-right: -1em;
|
||||
margin-left: 0;
|
||||
padding-right: calc(1em - 2px);
|
||||
padding-left: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<textarea id="text-input" style="display: none">{{content}}</textarea>
|
||||
@@ -365,21 +337,6 @@
|
||||
if (e.code === "Space") {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
// Support keyboard shortcuts for RTL and LTR text direction
|
||||
// RTL: Ctrl + RShift
|
||||
// LTR: Ctrl + LShift
|
||||
if ((e.ctrlKey || e.metaKey)) {
|
||||
if (e.shiftKey && e.location === KeyboardEvent.DOM_KEY_LOCATION_RIGHT) {
|
||||
// Right Shift + Ctrl: RTL
|
||||
document.documentElement.setAttribute('dir', 'rtl');
|
||||
e.preventDefault();
|
||||
} else if (e.shiftKey && e.location === KeyboardEvent.DOM_KEY_LOCATION_LEFT) {
|
||||
// Left Shift + Ctrl: LTR
|
||||
document.documentElement.setAttribute('dir', 'ltr');
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@@ -72,7 +72,6 @@
|
||||
Padding="3"
|
||||
FontSize="19"
|
||||
FontWeight="SemiBold"
|
||||
IsTextSelectionEnabled="True"
|
||||
LineHeight="25"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap">
|
||||
@@ -108,7 +107,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Calculating size..." />
|
||||
<!-- File Version -->
|
||||
<TextBlock x:Name="fileVersionTitle"
|
||||
@@ -123,7 +121,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis" />
|
||||
<!-- Product Version -->
|
||||
@@ -139,7 +136,6 @@
|
||||
Margin="8,0,0,0"
|
||||
Padding="3"
|
||||
Foreground="{DynamicResource WindowTextForegroundAlternative}"
|
||||
IsTextSelectionEnabled="True"
|
||||
Text="Searching..."
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextWrapping="Wrap" />
|
||||
|
@@ -220,6 +220,9 @@ public partial class App : Application
|
||||
ThemeManager.Apply(OSThemeHelper.AppsUseDarkTheme() ? ApplicationTheme.Dark : ApplicationTheme.Light);
|
||||
UxTheme.ApplyPreferredAppMode();
|
||||
|
||||
// Handle power management events to prevent crashes after sleep/wake
|
||||
SystemEvents.PowerModeChanged += OnPowerModeChanged;
|
||||
|
||||
// Initialize TrayIcon
|
||||
_ = TrayIconManager.GetInstance();
|
||||
|
||||
@@ -303,6 +306,9 @@ public partial class App : Application
|
||||
if (!_cleanExit)
|
||||
return;
|
||||
|
||||
// Unsubscribe from power management events
|
||||
SystemEvents.PowerModeChanged -= OnPowerModeChanged;
|
||||
|
||||
_isRunning.ReleaseMutex();
|
||||
|
||||
PipeServerManager.GetInstance().Dispose();
|
||||
@@ -330,4 +336,28 @@ public partial class App : Application
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void OnPowerModeChanged(object sender, PowerModeChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (e.Mode)
|
||||
{
|
||||
case PowerModes.Suspend:
|
||||
// System is going to sleep - close any open preview windows to prevent graphics issues
|
||||
ProcessHelper.WriteLog("System entering sleep mode - closing preview windows");
|
||||
ViewWindowManager.GetInstance().ClosePreview();
|
||||
break;
|
||||
case PowerModes.Resume:
|
||||
// System waking up - log for debugging
|
||||
ProcessHelper.WriteLog("System resumed from sleep mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Don't let power management exceptions crash the app
|
||||
ProcessHelper.WriteLog($"Error handling power mode change: {ex}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user