mirror of
https://github.com/QL-Win/QuickLook.git
synced 2025-12-23 02:00:26 +08:00
Fix #644 step 2: add context menu to TextViewer
This commit is contained in:
@@ -19,6 +19,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
@@ -50,6 +51,12 @@ namespace QuickLook.Plugin.TextViewer
|
||||
Options.EnableEmailHyperlinks = false;
|
||||
Options.EnableHyperlinks = false;
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
ContextMenu.Items.Add(new MenuItem
|
||||
{Header = TranslationHelper.Get("Editor_Copy"), Command = ApplicationCommands.Copy});
|
||||
ContextMenu.Items.Add(new MenuItem
|
||||
{Header = TranslationHelper.Get("Editor_SelectAll"), Command = ApplicationCommands.SelectAll});
|
||||
|
||||
ManipulationInertiaStarting += Viewer_ManipulationInertiaStarting;
|
||||
ManipulationStarting += Viewer_ManipulationStarting;
|
||||
ManipulationDelta += Viewer_ManipulationDelta;
|
||||
@@ -124,7 +131,7 @@ namespace QuickLook.Plugin.TextViewer
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
const int maxLength = 50 * 1024 * 1024;
|
||||
const int maxLength = 5 * 1024 * 1024;
|
||||
var buffer = new MemoryStream();
|
||||
bool tooLong;
|
||||
|
||||
@@ -146,7 +153,7 @@ namespace QuickLook.Plugin.TextViewer
|
||||
return;
|
||||
|
||||
if (tooLong)
|
||||
_context.Title += " (0 ~ 50MB)";
|
||||
_context.Title += " (0 ~ 5MB)";
|
||||
|
||||
var bufferCopy = buffer.ToArray();
|
||||
buffer.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user