Added a Markdown preview

This commit is contained in:
Thorsten Sommer 2025-12-05 20:30:43 +01:00
parent e753b9a2a7
commit 85ebc92b89
No known key found for this signature in database
GPG Key ID: B0B7E2FC074BF1F5
2 changed files with 40 additions and 14 deletions

View File

@ -27,20 +27,39 @@
/> />
} }
<MudTextField <MudTabs Elevation="0" Rounded="true" ApplyEffectsToContainer="true" Outlined="true" PanelClass="pa-2" Class="mb-2">
T="string" <MudTabPanel Text="@T("Markdown View")" Icon="@Icons.Material.Filled.TextSnippet">
@bind-Text="@this.FileContent" <MudField
AdornmentIcon="@Icons.Material.Filled.Article" Variant="Variant.Outlined"
Adornment="Adornment.Start" AdornmentIcon="@Icons.Material.Filled.Article"
Immediate="@true" Adornment="Adornment.Start"
Label="@T("Loaded Content")" Label="@T("Loaded Content")"
Variant="Variant.Outlined" FullWidth="true"
Lines="6" Class="ma-2 pe-4"
AutoGrow="@true" HelperText="@T("This is the content we loaded from your file — including headings, lists, and formatting. Use this to verify your file loads as expected.")"
MaxLines="25" >
Class="mt-10" <div style="max-height: 40vh; overflow-y: auto;">
ReadOnly="true" <MudMarkdown Value="@this.FileContent" Props="Markdown.DefaultConfig" Styling="@this.MarkdownStyling"/>
HelperText="@T("This is the content we loaded from your file — including headings, lists, and formatting. Use this to verify your file loads as expected.")"/> </div>
</MudField>
</MudTabPanel>
<MudTabPanel Text="@T("Raw View")" Icon="@Icons.Material.Filled.Terminal">
<MudTextField
T="string"
@bind-Text="@this.FileContent"
AdornmentIcon="@Icons.Material.Filled.Article"
Adornment="Adornment.Start"
Immediate="@true"
Label="@T("Loaded Content")"
Variant="Variant.Outlined"
Lines="6"
AutoGrow="@true"
MaxLines="25"
ReadOnly="true"
Class="ma-2"
HelperText="@T("This is the content we loaded from your file — including headings, lists, and formatting. Use this to verify your file loads as expected.")"/>
</MudTabPanel>
</MudTabs>
</DialogContent> </DialogContent>
<DialogActions> <DialogActions>

View File

@ -38,4 +38,11 @@ public partial class DocumentCheckDialog : MSGComponentBase
this.StateHasChanged(); this.StateHasChanged();
} }
} }
private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default;
private MudMarkdownStyling MarkdownStyling => new()
{
CodeBlock = { Theme = this.CodeColorPalette },
};
} }