-
Notifications
You must be signed in to change notification settings - Fork 79
MarkdownTextBlock: Rewrite lists to be text-based #684
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
MarkdownTextBlock: Rewrite lists to be text-based #684
Conversation
michael-hawker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the idea of translating lists into text instead of custom UI, makes a lot of sense and resolves a lot of issues with accessibility and copying.
Seeing how this works, I think the crux of the issue is that a List is contained in a Paragraph and we need to modify the properties of the parent paragraph to make this work/look good.
I'm wondering if we can be better here about using parsing to detect this or having the List Renderer make/be a paragraph vs. having to connect state between the paragraph and lists between the renderer. @nerocui any insights here?
I'd have to look at the parsing tree here (I wrote a tool for that actually a few weekends back, but still need to publish it.) Like I just wonder if in all cases a list is just encapsulated by a paragraph and any text before/after is a separate paragraph. If so, we should just make a dedicated "BulletedParagraph" type which will just output the final result that he Listrenderer does vs. it being a thing which needs to coordinate with the general paragraph.
Arlodotexe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, no bugs or regressions. Text selection across and between lists now works as expected.
|
cc @michael-hawker We could probably pull your work on tree parsing into a separate issue/PR to keep things moving. |
|
New issue opened to cleanup the state management. Should give us space to continue the discussion properly and allow us to close this off. |
michael-hawker
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, we'll merge for now and work towards to see if we can clean-up the state a bit in the future. Functionality wise, worked great.
Before, Lists were implemented using
InlineUIContainerand grid layouts. This looks great, but breaks selection and accessibility. This PR rewrites lists all-up to use a combination of Paragraph, the list bullet character (either a "dot" or the index number/alpha/roman), and smart use of margins and indents.WinUIRendererkeeps track of lists in a stack fashion, andMyParagraphuses the info from the renderer to offset the text and prepend the bullet character(s).