Markdown.Avalonia
Markdown.Avalonia copied to clipboard
Issue with text selection when content is scrolled
When the markdown is scrolled down, then selection behaves in a strange way - content is scrolled automatically to the top and random text gets selected.

Avalonia 11.0.0-preview6 Markdown.Avalonia 11.0.0-b1
When the markdown is scrolled down, then selection behaves in a strange way - content is scrolled automatically to the top and random text gets selected.
![]()
![]()
Avalonia 11.0.0-preview6 Markdown.Avalonia 11.0.0-b1
How do you add the line number one the left? Could I have refer it?
@dayAndnight2018
<Style Selector="avedit|TextEditor">
<Style.Setters>
<Setter Property="ShowLineNumbers" Value="True" />
</Style.Setters>
</Style>
I'm also struggling with this, any chance this can be looked into?
I'm trying to display Markdown text as shown in the binding example, but in this case, I can't select the text. Can you please advise on how to resolve this issue?
<md:MarkdownScrollViewer Markdown="{Binding MdText}"/>
@PhillBang You can only select text in AvaloniaEdit.TextEditor from my experience.
I solved it by overriding RequestBringIntoViewEvent event:
public class CustomMarkdownScrollViewer : Markdown.Avalonia.MarkdownScrollViewer
{
public CustomMarkdownScrollViewer()
{
Plugins = new MdAvPlugins();
AddHandler(RequestBringIntoViewEvent, OnRequestBringIntoView, handledEventsToo: true);
}
private void OnRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
{
e.Handled = true;
}
protected override void OnPointerPressed(PointerPressedEventArgs e)
{
base.OnPointerPressed(e);
// Optionally, handle pointer pressed event to prevent focus
e.Handled = true;
}
}