Supports text selection, copy button in a code block and header scroll event
Pre-release
Pre-release
Text Selection
MarkdownScrollViewer
has new property SelectionEnabled
to enable text selection.
<!-- xmlns:md="https://github.com/whistyun/Markdown.Avalonia" -->
<md:MarkdownScrollViewer SelectionEnabled="True"
...
/>
At the moment, only plain text copies are provided due to functional limitations of the Avalonia.
Copy button in a code block
This package display a lang and copy button.
A button label can be changed using Style.
<Styles xmlns="https://github.com/avaloniaui">
<Style Selector=".CodeBlock Button.CopyButton TextBlock">
<Setter Property="Text" Value="π"/>
</Style>
</Styles>
Header scroll event
MarkdownScrollViewer
has new event HeaderScrolled
to notify that the header has been scrolled.
MainWindow.axaml:
<!-- xmlns:md="https://github.com/whistyun/Markdown.Avalonia" -->
<Label x:Name="Breadcrumb"
/>
<md:MarkdownScrollViewer
HeaderScrolled="HeaderScrolled"
...
/>
MainWindow.axaml.cs
public partial class MainWindow : Window
{
private Label _breadcrumb;
private void HeaderScrolled(object sender, HeaderScrolledEventArgs args)
{
_breadcrumb.Content = string.Join(" > ", args.Tree.Select(tag => tag.Text));
}
}