mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Monaco]Add option to set font size (#32559)
* Add setting to enable/disable it and add Peek support * Add ability to set font size
This commit is contained in:
committed by
GitHub
parent
5b4da37a43
commit
d9008186cf
@@ -397,6 +397,8 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
||||
_html = _html.Replace("[[PT_LANG]]", _vsCodeLangSet, StringComparison.InvariantCulture);
|
||||
_html = _html.Replace("[[PT_WRAP]]", _settings.Wrap ? "1" : "0", 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_FONT_SIZE]]", _settings.FontSize.ToString(CultureInfo.InvariantCulture), StringComparison.InvariantCulture);
|
||||
_html = _html.Replace("[[PT_CODE]]", _base64FileCode, StringComparison.InvariantCulture);
|
||||
_html = _html.Replace("[[PT_STICKY_SCROLL]]", _settings.StickyScroll ? "1" : "0", StringComparison.InvariantCulture);
|
||||
_html = _html.Replace("[[PT_URL]]", FilePreviewCommon.MonacoHelper.VirtualHostName, StringComparison.InvariantCulture);
|
||||
|
||||
@@ -77,6 +77,26 @@ namespace Microsoft.PowerToys.PreviewHandler.Monaco
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the font size for the previewer. Set by PT settings.
|
||||
/// </summary>
|
||||
public double FontSize
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return moduleSettings.GetSettings<PowerPreviewSettings>(PowerPreviewSettings.ModuleName).Properties.MonacoPreviewFontSize.Value;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
// Couldn't read the settings.
|
||||
// Assume default of 14.
|
||||
return 14;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether sticky scroll should be enabled. Set by PT settings.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user