[Dev file preview]Add wrap text setting (#16486)

* Push (not working)

* Add Context menu

* push

* Adress feedback

* Update installer

* Fix build

* Fix warnings
This commit is contained in:
Aaron Junker
2022-03-25 18:29:33 +01:00
committed by GitHub
parent 4aadaf9bf1
commit 79227b9db6
8 changed files with 123 additions and 21 deletions

View File

@@ -80,6 +80,23 @@ namespace Microsoft.PowerToys.Settings.UI.Library
}
}
private bool monacoPreviewWordWrap = true;
[JsonPropertyName("monaco-previewer-toggle-setting-word-wrap")]
[JsonConverter(typeof(BoolPropertyJsonConverter))]
public bool EnableMonacoPreviewWordWrap
{
get => monacoPreviewWordWrap;
set
{
if (value != monacoPreviewWordWrap)
{
LogTelemetryEvent(value);
monacoPreviewWordWrap = value;
}
}
}
private bool enablePdfPreview = true;
[JsonPropertyName("pdf-previewer-toggle-setting")]

View File

@@ -50,6 +50,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_svgThumbnailIsEnabled = Settings.Properties.EnableSvgThumbnail;
_mdRenderIsEnabled = Settings.Properties.EnableMdPreview;
_monacoRenderIsEnabled = Settings.Properties.EnableMonacoPreview;
_monacoWrapText = Settings.Properties.EnableMonacoPreviewWordWrap;
_pdfRenderIsEnabled = Settings.Properties.EnablePdfPreview;
_gcodeRenderIsEnabled = Settings.Properties.EnableGcodePreview;
_pdfThumbnailIsEnabled = Settings.Properties.EnablePdfThumbnail;
@@ -60,6 +61,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private bool _svgRenderIsEnabled;
private bool _mdRenderIsEnabled;
private bool _monacoRenderIsEnabled;
private bool _monacoWrapText;
private bool _pdfRenderIsEnabled;
private bool _gcodeRenderIsEnabled;
private bool _svgThumbnailIsEnabled;
@@ -139,6 +141,24 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public bool MonacoWrapText
{
get
{
return _monacoWrapText;
}
set
{
if (_monacoWrapText != value)
{
_monacoWrapText = value;
Settings.Properties.EnableMonacoPreviewWordWrap = value;
RaisePropertyChanged();
}
}
}
public bool PDFRenderIsEnabled
{
get

View File

@@ -2053,6 +2053,10 @@ From there, simply click on one of the supported files in the File Explorer and
<value>Attribution</value>
<comment>giving credit to the projects this utility was based on</comment>
</data>
<data name="FileExplorerPreview_ToggleSwitch_Monaco_Wrap_Text.Content" xml:space="preserve">
<value>Wrap text</value>
<comment>Feature on or off</comment>
</data>
<data name="FancyZones_AllowPopupWindowSnap.Description" xml:space="preserve">
<value>This setting can affect all popup windows including notifications</value>
</data>

View File

@@ -35,12 +35,25 @@
</controls:Setting.ActionContent>
</controls:Setting>
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_Preview_Monaco" Icon="&#xE99A;">
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.MonacoRenderIsEnabled}"
<controls:SettingExpander IsExpanded="False">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_Preview_Monaco" Icon="&#xE99A;">
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind Mode=TwoWay, Path=ViewModel.MonacoRenderIsEnabled}"
x:Uid="ToggleSwitch"/>
</controls:Setting.ActionContent>
</controls:Setting>
</controls:Setting.ActionContent>
</controls:Setting>
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<StackPanel>
<CheckBox x:Uid="FileExplorerPreview_ToggleSwitch_Monaco_Wrap_Text"
IsChecked="{x:Bind ViewModel.MonacoWrapText, Mode=TwoWay}"
Margin="{StaticResource ExpanderSettingMargin}"
IsEnabled="{x:Bind ViewModel.MonacoRenderIsEnabled, Mode=OneWay}" />
</StackPanel>
</controls:SettingExpander.Content>
</controls:SettingExpander>
<controls:Setting x:Uid="FileExplorerPreview_ToggleSwitch_Preview_PDF" Icon="&#xEA90;">
<controls:Setting.ActionContent>