mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 03:37:59 +01:00
[Peek]Add wrap and formatting options for Monaco previewer (#29378)
* add options for monaco previewer * fix formatting
This commit is contained in:
committed by
GitHub
parent
9693fd7035
commit
5a06bcb473
@@ -13,13 +13,14 @@ using Peek.Common.Extensions;
|
||||
using Peek.Common.Helpers;
|
||||
using Peek.Common.Models;
|
||||
using Peek.FilePreviewer.Models;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace Peek.FilePreviewer.Previewers
|
||||
{
|
||||
public partial class WebBrowserPreviewer : ObservableObject, IBrowserPreviewer, IDisposable
|
||||
{
|
||||
private static readonly HashSet<string> _supportedFileTypes = new HashSet<string>
|
||||
private readonly IPreviewSettings _previewSettings;
|
||||
|
||||
private static readonly HashSet<string> _supportedFileTypes = new()
|
||||
{
|
||||
// Web
|
||||
".html",
|
||||
@@ -43,8 +44,9 @@ namespace Peek.FilePreviewer.Previewers
|
||||
|
||||
private bool disposed;
|
||||
|
||||
public WebBrowserPreviewer(IFileSystemItem file)
|
||||
public WebBrowserPreviewer(IFileSystemItem file, IPreviewSettings previewSettings)
|
||||
{
|
||||
_previewSettings = previewSettings;
|
||||
File = file;
|
||||
Dispatcher = DispatcherQueue.GetForCurrentThread();
|
||||
}
|
||||
@@ -109,7 +111,7 @@ namespace Peek.FilePreviewer.Previewers
|
||||
if (IsDevFilePreview && !isHtml && !isMarkdown)
|
||||
{
|
||||
var raw = await ReadHelper.Read(File.Path.ToString());
|
||||
Preview = new Uri(MonacoHelper.PreviewTempFile(raw, File.Extension, TempFolderPath.Path));
|
||||
Preview = new Uri(MonacoHelper.PreviewTempFile(raw, File.Extension, TempFolderPath.Path, _previewSettings.SourceCodeTryFormat, _previewSettings.SourceCodeWrapText));
|
||||
}
|
||||
else if (isMarkdown)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user