Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with text selection when content is scrolled #109

Open
cezarypiatek opened this issue May 8, 2023 · 6 comments
Open

Issue with text selection when content is scrolled #109

cezarypiatek opened this issue May 8, 2023 · 6 comments

Comments

@cezarypiatek
Copy link

cezarypiatek commented May 8, 2023

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.
WireMockInspector_hpoqMYSK0e

Avalonia 11.0.0-preview6
Markdown.Avalonia 11.0.0-b1

@dayAndnight2018
Copy link

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. WireMockInspector_hpoqMYSK0e WireMockInspector_hpoqMYSK0e

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?

@oskar-ziller
Copy link

@dayAndnight2018

                    <Style Selector="avedit|TextEditor">
                        <Style.Setters>
                            <Setter Property="ShowLineNumbers" Value="True" />
                        </Style.Setters>
                    </Style>

@oskar-ziller
Copy link

I'm also struggling with this, any chance this can be looked into?

@PhillBang
Copy link

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}"/>

@oskar-ziller
Copy link

@PhillBang You can only select text in AvaloniaEdit.TextEditor from my experience.

@oskar-ziller
Copy link

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;
		}
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants