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

[SuperEditor][SuperReader] - Implement line-based layout #2359

Open
matthew-carroll opened this issue Sep 29, 2024 · 0 comments
Open

[SuperEditor][SuperReader] - Implement line-based layout #2359

matthew-carroll opened this issue Sep 29, 2024 · 0 comments
Labels
area_attributed_text Related to attributed_text area_infrastructure Pertains to cross-cutting infrastructure area_super_reader Related to SuperReader area_super_text area_supereditor Pertains to SuperEditor bounty_junior time: 40

Comments

@matthew-carroll
Copy link
Contributor

Flutter implements block-based layout, even for test. In Flutter, one lays out an entire paragraph (or block) of text at one time.

Many features in rich text layout depend upon the flow of lines of text:

  • Styled text runs within text runs
    • Inline code
    • Tags (users, docs, tasks)
  • Inline bitmaps (think emojis but bitmaps)
  • Text-embedded UI (injecting a button in the middle of text)
  • A single block of text flowing around obstacles (like flowing around an image)

Flutter doesn't support these use-cases, except perhaps inline bitmaps. Flutter technically supports inline widgets but this support is almost useless when it comes to the needs of rich text layout and editing. Instead, what's needed is a completely different layout approach.

Ideally, Flutter would expose the full surface area of SkParagraph, which is the underlying text shaping library that Flutter uses. With full access to SkParagraph, we could probably build our own render object that calculates layout in a relatively efficient manner.

However, Flutter has only included a subset of SkParagraph. As a result, implementing line-based layout requires repeatedly measuring blocks of text, querying line breaks, injecting non-text content, and then continuing the process.

For this ticket, implement the aforementioned line-based layout by writing one or more custom render objects, which both layout content based on lines, and also reports any relevant bounds to other widgets.

@matthew-carroll matthew-carroll added area_supereditor Pertains to SuperEditor area_infrastructure Pertains to cross-cutting infrastructure bounty_junior area_attributed_text Related to attributed_text area_super_text area_super_reader Related to SuperReader time: 40 labels Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area_attributed_text Related to attributed_text area_infrastructure Pertains to cross-cutting infrastructure area_super_reader Related to SuperReader area_super_text area_supereditor Pertains to SuperEditor bounty_junior time: 40
Projects
None yet
Development

No branches or pull requests

1 participant