From 20f528cb82d5587245312aee10750d48094b2f4b Mon Sep 17 00:00:00 2001 From: PesBandi <127593627+PesBandi@users.noreply.github.com> Date: Sat, 22 Jun 2024 08:40:32 +0200 Subject: [PATCH 1/3] Make minimap toggleable --- .../Assets/Monaco/index.html | 21 ++++++++++++++++++- .../Models/IPreviewSettings.cs | 2 ++ .../Models/PreviewSettings.cs | 4 ++++ .../Helpers/MonacoHelper.cs | 8 +++---- .../WebBrowserPreviewer.cs | 2 +- .../MonacoPreviewHandlerControl.cs | 1 + .../MonacoPreviewHandler/Settings.cs | 20 ++++++++++++++++++ .../PeekPreviewSettings.cs | 3 +++ .../PowerPreviewProperties.cs | 17 +++++++++++++++ .../SettingsXAML/Views/PeekPage.xaml | 3 +++ .../SettingsXAML/Views/PowerPreviewPage.xaml | 6 ++++++ .../Settings.UI/Strings/en-us/Resources.resw | 6 ++++++ .../Settings.UI/ViewModels/PeekViewModel.cs | 14 +++++++++++++ .../ViewModels/PowerPreviewViewModel.cs | 16 ++++++++++++++ 14 files changed, 117 insertions(+), 6 deletions(-) diff --git a/src/common/FilePreviewCommon/Assets/Monaco/index.html b/src/common/FilePreviewCommon/Assets/Monaco/index.html index 26d63dee297..1dcb3fe47d8 100644 --- a/src/common/FilePreviewCommon/Assets/Monaco/index.html +++ b/src/common/FilePreviewCommon/Assets/Monaco/index.html @@ -9,10 +9,12 @@ // `theme` can be "vs" for light theme or "vs-dark" for dark theme // `lang` is the language of the file // `wrap` if the editor is wrapping or not + // `minimap` if the minimap is shown var theme = ("[[PT_THEME]]" == "dark") ? "vs-dark" : "vs"; var lang = "[[PT_LANG]]"; var wrap = ([[PT_WRAP]] == 1) ? true : false; + var minimap = [[PT_MINIMAP]]; var base64code = "[[PT_CODE]]"; @@ -80,7 +82,7 @@ language: lang, // Sets language of the code readOnly: true, // Sets to readonly theme: 'theme', // Sets editor theme - minimap: {enabled: false}, // Disables minimap + minimap: {enabled: minimap}, // Controls if minimap is shown lineNumbersMinChars: '3', // Width of the line numbers scrollbar: { // Deactivate shadows @@ -126,6 +128,23 @@ } }); + editor.addAction({ + id: 'toggle-minimap', + + label: 'Toggle minimap', + + contextMenuGroupId: 'cutcopypaste', + + contextMenuOrder: 100, + + // Method that will be executed when the action is triggered. + // @param editor The editor instance is passed in as a convenience + run: editor => { + editor.updateOptions({minimap: {enabled: !minimap}}); + minimap = !minimap; + } + }); + onContextMenu(); }); diff --git a/src/modules/peek/Peek.FilePreviewer/Models/IPreviewSettings.cs b/src/modules/peek/Peek.FilePreviewer/Models/IPreviewSettings.cs index 9a89d9a4aa5..e9c0a66cf72 100644 --- a/src/modules/peek/Peek.FilePreviewer/Models/IPreviewSettings.cs +++ b/src/modules/peek/Peek.FilePreviewer/Models/IPreviewSettings.cs @@ -13,5 +13,7 @@ public interface IPreviewSettings public int SourceCodeFontSize { get; } public bool SourceCodeStickyScroll { get; } + + public bool SourceCodeMinimap { get; } } } diff --git a/src/modules/peek/Peek.FilePreviewer/Models/PreviewSettings.cs b/src/modules/peek/Peek.FilePreviewer/Models/PreviewSettings.cs index 1be17f3689e..295ed52a79f 100644 --- a/src/modules/peek/Peek.FilePreviewer/Models/PreviewSettings.cs +++ b/src/modules/peek/Peek.FilePreviewer/Models/PreviewSettings.cs @@ -29,6 +29,8 @@ public class PreviewSettings : IPreviewSettings public bool SourceCodeStickyScroll { get; private set; } + public bool SourceCodeMinimap { get; private set; } + public PreviewSettings() { _settingsUtils = new SettingsUtils(); @@ -36,6 +38,7 @@ public PreviewSettings() SourceCodeTryFormat = false; SourceCodeFontSize = 14; SourceCodeStickyScroll = true; + SourceCodeMinimap = false; LoadSettingsFromJson(); @@ -69,6 +72,7 @@ private void LoadSettingsFromJson() SourceCodeTryFormat = settings.SourceCodeTryFormat.Value; SourceCodeFontSize = settings.SourceCodeFontSize.Value; SourceCodeStickyScroll = settings.SourceCodeStickyScroll.Value; + SourceCodeMinimap = settings.SourceCodeMinimap.Value; } retry = false; diff --git a/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/Helpers/MonacoHelper.cs b/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/Helpers/MonacoHelper.cs index 33649976959..007d787e065 100644 --- a/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/Helpers/MonacoHelper.cs +++ b/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/Helpers/MonacoHelper.cs @@ -46,13 +46,13 @@ public static HashSet GetExtensions() /// /// Prepares temp html for the previewing /// - public static string PreviewTempFile(string fileText, string extension, string tempFolder, bool tryFormat, bool wrapText, bool stickyScroll, int fontSize) + public static string PreviewTempFile(string fileText, string extension, string tempFolder, bool tryFormat, bool wrapText, bool stickyScroll, int fontSize, bool minimap) { // TODO: check if file is too big, add MaxFileSize to settings - return InitializeIndexFileAndSelectedFile(fileText, extension, tempFolder, tryFormat, wrapText, stickyScroll, fontSize); + return InitializeIndexFileAndSelectedFile(fileText, extension, tempFolder, tryFormat, wrapText, stickyScroll, fontSize, minimap); } - private static string InitializeIndexFileAndSelectedFile(string fileContent, string extension, string tempFolder, bool tryFormat, bool wrapText, bool stickyScroll, int fontSize) + private static string InitializeIndexFileAndSelectedFile(string fileContent, string extension, string tempFolder, bool tryFormat, bool wrapText, bool stickyScroll, int fontSize, bool minimap) { string vsCodeLangSet = Microsoft.PowerToys.FilePreviewCommon.MonacoHelper.GetLanguage(extension); @@ -85,7 +85,7 @@ private static string InitializeIndexFileAndSelectedFile(string fileContent, str html = html.Replace("[[PT_FONT_SIZE]]", fontSize.ToString(CultureInfo.InvariantCulture), StringComparison.InvariantCulture); html = html.Replace("[[PT_CODE]]", base64FileCode, StringComparison.InvariantCulture); html = html.Replace("[[PT_URL]]", Microsoft.PowerToys.FilePreviewCommon.MonacoHelper.VirtualHostName, StringComparison.InvariantCulture); - + html = html.Replace("[[PT_MINIMAP]]", minimap ? "true" : "false", StringComparison.InvariantCulture); string filename = tempFolder + "\\" + Guid.NewGuid().ToString() + ".html"; File.WriteAllText(filename, html); return filename; diff --git a/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/WebBrowserPreviewer.cs b/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/WebBrowserPreviewer.cs index 1c35093ddb2..a1847c0fa11 100644 --- a/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/WebBrowserPreviewer.cs +++ b/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/WebBrowserPreviewer.cs @@ -112,7 +112,7 @@ await Dispatcher.RunOnUiThread(async () => if (IsDevFilePreview && !isHtml && !isMarkdown) { var raw = await ReadHelper.Read(File.Path.ToString()); - Preview = new Uri(MonacoHelper.PreviewTempFile(raw, File.Extension, TempFolderPath.Path, _previewSettings.SourceCodeTryFormat, _previewSettings.SourceCodeWrapText, _previewSettings.SourceCodeStickyScroll, _previewSettings.SourceCodeFontSize)); + Preview = new Uri(MonacoHelper.PreviewTempFile(raw, File.Extension, TempFolderPath.Path, _previewSettings.SourceCodeTryFormat, _previewSettings.SourceCodeWrapText, _previewSettings.SourceCodeStickyScroll, _previewSettings.SourceCodeFontSize, _previewSettings.SourceCodeMinimap)); } else if (isMarkdown) { diff --git a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs index 8f0613e5122..c8adb6284b0 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs +++ b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs @@ -401,6 +401,7 @@ private void InitializeIndexFileAndSelectedFile(string filePath) _html = _html.Replace("[[PT_FONT_SIZE]]", _settings.FontSize.ToString(CultureInfo.InvariantCulture), StringComparison.InvariantCulture); _html = _html.Replace("[[PT_CODE]]", _base64FileCode, StringComparison.InvariantCulture); _html = _html.Replace("[[PT_URL]]", FilePreviewCommon.MonacoHelper.VirtualHostName, StringComparison.InvariantCulture); + _html = _html.Replace("[[PT_MINIMAP]]", _settings.Minimap ? "true" : "false", StringComparison.InvariantCulture); } private async void DownloadLink_Click(object sender, EventArgs e) diff --git a/src/modules/previewpane/MonacoPreviewHandler/Settings.cs b/src/modules/previewpane/MonacoPreviewHandler/Settings.cs index 03dd2148fe3..26a5a4b0566 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/Settings.cs +++ b/src/modules/previewpane/MonacoPreviewHandler/Settings.cs @@ -117,6 +117,26 @@ public bool StickyScroll } } + /// + /// Gets a value indicating whether the minimap should be enabled. Set by PT settings. + /// + public bool Minimap + { + get + { + try + { + return moduleSettings.GetSettings(PowerPreviewSettings.ModuleName).Properties.MonacoPreviewMinimap; + } + catch (FileNotFoundException) + { + // Couldn't read the settings + // Assume default of false + return false; + } + } + } + /// /// Gets the color of the window background. /// diff --git a/src/settings-ui/Settings.UI.Library/PeekPreviewSettings.cs b/src/settings-ui/Settings.UI.Library/PeekPreviewSettings.cs index 75562ca9a29..c070284ec3f 100644 --- a/src/settings-ui/Settings.UI.Library/PeekPreviewSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PeekPreviewSettings.cs @@ -20,12 +20,15 @@ public class PeekPreviewSettings : ISettingsConfig public BoolProperty SourceCodeStickyScroll { get; set; } + public BoolProperty SourceCodeMinimap { get; set; } + public PeekPreviewSettings() { SourceCodeWrapText = new BoolProperty(false); SourceCodeTryFormat = new BoolProperty(false); SourceCodeFontSize = new IntProperty(14); SourceCodeStickyScroll = new BoolProperty(true); + SourceCodeMinimap = new BoolProperty(false); } public string ToJsonString() diff --git a/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs b/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs index 1c09438b61f..a4bb3aaf146 100644 --- a/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs @@ -154,6 +154,23 @@ public bool MonacoPreviewStickyScroll } } + private bool monacoPreviewMinimap = true; + + [JsonPropertyName("monaco-previewer-minimap")] + [JsonConverter(typeof(BoolPropertyJsonConverter))] + public bool MonacoPreviewMinimap + { + get => monacoPreviewMinimap; + set + { + if (value != monacoPreviewMinimap) + { + LogTelemetryEvent(value); + monacoPreviewMinimap = value; + } + } + } + private bool enablePdfPreview; [JsonPropertyName("pdf-previewer-toggle-setting")] diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PeekPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PeekPage.xaml index e7ec1c3610e..9441a68d7db 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PeekPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PeekPage.xaml @@ -66,6 +66,9 @@ + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml index f4836958201..ea87eb8db61 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerPreviewPage.xaml @@ -103,6 +103,12 @@ IsChecked="{x:Bind ViewModel.MonacoPreviewStickyScroll, Mode=TwoWay}" IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}" /> + + + diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index 5099a48b418..6acb50f2b76 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -4105,6 +4105,9 @@ Activate by holding the key for the character you want to add an accent to, then Wrap text + + Show minimap + All @@ -4148,6 +4151,9 @@ Activate by holding the key for the character you want to add an accent to, then Enable sticky scroll + + Show minimap + Enable sticky scroll diff --git a/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs index 4672d0dabf8..1c1c09e11bb 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs @@ -201,6 +201,20 @@ public bool SourceCodeStickyScroll } } + public bool SourceCodeMinimap + { + get => _peekPreviewSettings.SourceCodeMinimap.Value; + set + { + if (_peekPreviewSettings.SourceCodeMinimap.Value != value) + { + _peekPreviewSettings.SourceCodeMinimap.Value = value; + OnPropertyChanged(nameof(SourceCodeMinimap)); + SavePreviewSettings(); + } + } + } + private void NotifySettingsChanged() { // Using InvariantCulture as this is an IPC message diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs index fa494f6cd58..151a08193e6 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs @@ -94,6 +94,7 @@ public PowerPreviewViewModel(ISettingsRepository moduleSet _monacoMaxFileSize = Settings.Properties.MonacoPreviewMaxFileSize.Value; _monacoFontSize = Settings.Properties.MonacoPreviewFontSize.Value; _monacoStickyScroll = Settings.Properties.MonacoPreviewStickyScroll; + _monacoMinimap = Settings.Properties.MonacoPreviewMinimap; _pdfRenderEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredPdfPreviewEnabledValue(); if (_pdfRenderEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _pdfRenderEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled) @@ -235,6 +236,7 @@ public PowerPreviewViewModel(ISettingsRepository moduleSet private int _monacoMaxFileSize; private bool _monacoStickyScroll; private int _monacoFontSize; + private bool _monacoMinimap; private GpoRuleConfigured _pdfRenderEnabledGpoRuleConfiguration; private bool _pdfRenderEnabledStateIsGPOConfigured; @@ -617,6 +619,20 @@ public bool MonacoPreviewStickyScroll } } + public bool MonacoPreviewMinimap + { + get => _monacoMinimap; + set + { + if (_monacoMinimap != value) + { + _monacoMinimap = value; + Settings.Properties.MonacoPreviewMinimap = value; + RaisePropertyChanged(); + } + } + } + public int MonacoPreviewFontSize { get From a31ae821efb2404561e4a2b4397e5d8d7ff6a1e2 Mon Sep 17 00:00:00 2001 From: PesBandi <127593627+PesBandi@users.noreply.github.com> Date: Tue, 9 Jul 2024 14:53:02 +0200 Subject: [PATCH 2/3] Update PowerPreviewProperties.cs --- src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs b/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs index a4bb3aaf146..79a4a1f037f 100644 --- a/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs @@ -154,7 +154,7 @@ public bool MonacoPreviewStickyScroll } } - private bool monacoPreviewMinimap = true; + private bool monacoPreviewMinimap; [JsonPropertyName("monaco-previewer-minimap")] [JsonConverter(typeof(BoolPropertyJsonConverter))] From 55bcde495daac4f7e9778be40bed4d4325983b88 Mon Sep 17 00:00:00 2001 From: PesBandi <127593627+PesBandi@users.noreply.github.com> Date: Fri, 23 Aug 2024 17:04:18 +0200 Subject: [PATCH 3/3] Update code to reflect changes from #33845 --- .../Assets/Monaco/index.html | 36 ++++++++----------- .../Controls/BrowserControl.xaml.cs | 1 + .../Helpers/MonacoHelper.cs | 6 ++-- .../peek/Peek.UI/Strings/en-us/Resources.resw | 3 ++ .../MonacoPreviewHandlerControl.cs | 6 ++-- 5 files changed, 24 insertions(+), 28 deletions(-) diff --git a/src/common/FilePreviewCommon/Assets/Monaco/index.html b/src/common/FilePreviewCommon/Assets/Monaco/index.html index 117fa545d07..af312e1f3de 100644 --- a/src/common/FilePreviewCommon/Assets/Monaco/index.html +++ b/src/common/FilePreviewCommon/Assets/Monaco/index.html @@ -12,16 +12,14 @@ // `minimap` if the minimap is shown var theme = ("[[PT_THEME]]" == "dark") ? "vs-dark" : "vs"; - var lang = "[[PT_LANG]]"; - var wrap = ([[PT_WRAP]] == 1) ? true : false; + var wrap = [[PT_WRAP]]; var minimap = [[PT_MINIMAP]]; - - var base64code = "[[PT_CODE]]"; - - var stickyScroll = ([[PT_STICKY_SCROLL]] == 1) ? true : false; - + var stickyScroll = [[PT_STICKY_SCROLL]]; var fontSize = [[PT_FONT_SIZE]]; - var contextMenu = ([[PT_CONTEXTMENU]] == 1) ? true : false; + var contextMenu = [[PT_CONTEXTMENU]]; + + var lang = "[[PT_LANG]]"; + var base64code = "[[PT_CODE]]"; var editor; @@ -31,12 +29,13 @@ }).join('')); function runToggleTextWrapCommand() { - if (wrap) { - editor.updateOptions({ wordWrap: 'off' }) - } else { - editor.updateOptions({ wordWrap: 'on' }) - } wrap = !wrap; + editor.updateOptions({ wordWrap: wrap ? 'on' : 'off' }); + } + + function runToggleMinimap() { + minimap = !minimap; + editor.updateOptions({minimap: {enabled: minimap}}); } function runCopyCommand() { @@ -137,10 +136,7 @@ contextMenuOrder: 100, // Method that will be executed when the action is triggered. - // @param editor The editor instance is passed in as a convenience - run: function (ed) { - runToggleTextWrapCommand(); - } + run: runToggleTextWrapCommand }); editor.addAction({ @@ -153,11 +149,7 @@ contextMenuOrder: 100, // Method that will be executed when the action is triggered. - // @param editor The editor instance is passed in as a convenience - run: editor => { - editor.updateOptions({minimap: {enabled: !minimap}}); - minimap = !minimap; - } + run: runToggleMinimap }); onContextMenu(); diff --git a/src/modules/peek/Peek.FilePreviewer/Controls/BrowserControl.xaml.cs b/src/modules/peek/Peek.FilePreviewer/Controls/BrowserControl.xaml.cs index fe170bee0e7..32b9d2c756a 100644 --- a/src/modules/peek/Peek.FilePreviewer/Controls/BrowserControl.xaml.cs +++ b/src/modules/peek/Peek.FilePreviewer/Controls/BrowserControl.xaml.cs @@ -233,6 +233,7 @@ MenuItem CreateCommandMenuItem(string resourceId, string commandName) CreateCommandMenuItem("ContextMenu_Copy", "runCopyCommand"), new Separator(), CreateCommandMenuItem("ContextMenu_ToggleTextWrapping", "runToggleTextWrapCommand"), + CreateCommandMenuItem("ContextMenu_ToggleMinimap", "runToggleMinimap") ]; } else diff --git a/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/Helpers/MonacoHelper.cs b/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/Helpers/MonacoHelper.cs index 2de337b8506..6d1cc1097af 100644 --- a/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/Helpers/MonacoHelper.cs +++ b/src/modules/peek/Peek.FilePreviewer/Previewers/WebBrowserPreviewer/Helpers/MonacoHelper.cs @@ -79,9 +79,9 @@ private static string InitializeIndexFileAndSelectedFile(string fileContent, str string html = Microsoft.PowerToys.FilePreviewCommon.MonacoHelper.ReadIndexHtml(); html = html.Replace("[[PT_LANG]]", vsCodeLangSet, StringComparison.InvariantCulture); - html = html.Replace("[[PT_WRAP]]", wrapText ? "1" : "0", StringComparison.InvariantCulture); - html = html.Replace("[[PT_CONTEXTMENU]]", "0", StringComparison.InvariantCulture); - html = html.Replace("[[PT_STICKY_SCROLL]]", stickyScroll ? "1" : "0", StringComparison.InvariantCulture); + html = html.Replace("[[PT_WRAP]]", wrapText ? "true" : "false", StringComparison.InvariantCulture); + html = html.Replace("[[PT_CONTEXTMENU]]", "false", StringComparison.InvariantCulture); + html = html.Replace("[[PT_STICKY_SCROLL]]", stickyScroll ? "true" : "false", StringComparison.InvariantCulture); html = html.Replace("[[PT_THEME]]", theme, StringComparison.InvariantCulture); html = html.Replace("[[PT_FONT_SIZE]]", fontSize.ToString(CultureInfo.InvariantCulture), StringComparison.InvariantCulture); html = html.Replace("[[PT_CODE]]", base64FileCode, StringComparison.InvariantCulture); diff --git a/src/modules/peek/Peek.UI/Strings/en-us/Resources.resw b/src/modules/peek/Peek.UI/Strings/en-us/Resources.resw index c6b7945d337..97b81db0b44 100644 --- a/src/modules/peek/Peek.UI/Strings/en-us/Resources.resw +++ b/src/modules/peek/Peek.UI/Strings/en-us/Resources.resw @@ -326,4 +326,7 @@ Toggle text wrapping Toggle whether text in pane is word-wrapped + + Toggle minimap + \ No newline at end of file diff --git a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs index 22cd5dc6381..acc6fad25ec 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs +++ b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs @@ -395,10 +395,10 @@ private void InitializeIndexFileAndSelectedFile(string filePath) // prepping index html to load in _html = FilePreviewCommon.MonacoHelper.ReadIndexHtml(); _html = _html.Replace("[[PT_LANG]]", _vsCodeLangSet, StringComparison.InvariantCulture); - _html = _html.Replace("[[PT_WRAP]]", _settings.Wrap ? "1" : "0", StringComparison.InvariantCulture); - _html = _html.Replace("[[PT_CONTEXTMENU]]", "1", StringComparison.InvariantCulture); + _html = _html.Replace("[[PT_WRAP]]", _settings.Wrap ? "true" : "false", StringComparison.InvariantCulture); + _html = _html.Replace("[[PT_CONTEXTMENU]]", "true", StringComparison.InvariantCulture); _html = _html.Replace("[[PT_THEME]]", Settings.GetTheme(), StringComparison.InvariantCulture); - _html = _html.Replace("[[PT_STICKY_SCROLL]]", _settings.StickyScroll ? "1" : "0", StringComparison.InvariantCulture); + _html = _html.Replace("[[PT_STICKY_SCROLL]]", _settings.StickyScroll ? "true" : "false", StringComparison.InvariantCulture); _html = _html.Replace("[[PT_FONT_SIZE]]", _settings.FontSize.ToString(CultureInfo.InvariantCulture), StringComparison.InvariantCulture); _html = _html.Replace("[[PT_CODE]]", _base64FileCode, StringComparison.InvariantCulture); _html = _html.Replace("[[PT_URL]]", FilePreviewCommon.MonacoHelper.VirtualHostName, StringComparison.InvariantCulture);