feat(text): markdown formatting with floating format bar - #175
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
This comment has been minimized.
This comment has been minimized.
…heck Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… for active Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The card's vertical padding drops from 12px to 4px and moves into the shared frame, so editing, previews, and exports agree. The format bar is sized for the five buttons it holds, evenly spaced, with corners that sit against the text card. Active toggles are checked tools: a raised violet surface under a white glyph. No tooltips, which covered the text being written. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Renumbering shifted a caret only by its own line's prefix change, so when an earlier item went from 9. to 10. a caret further down landed one character early. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Summary
Text widgets now understand a small Markdown subset and get a floating format bar while editing, so people who don't know the syntax can still bold, bullet, number, and head their notes. Always on, no setting.
PlacedText.textstays a plainString(the source with markers), so nothing changes for Hive, migrations, or.icaround-trips; old strategies render exactly as before unless they happen to contain markers.Supported:
**bold**,*italic*/_italic_,-/*/•bullets,1./1)numbered,#–###headings. Unclosed markers stay literal. No Markdown dependency; the parser is ~200 lines intext_markup.dart.How it fits together
FormattedTextView. Tap →TextField(decoration: null)withMarkupTextEditingController, both inside the same 12px vertical padding, so the card is the same height in either state (hint is drawn by hand for the empty case); focus loss commits the draft and returns to the formatted view. Same swap for drag feedback, screenshots, and page transitions, so every non-editing path renders formatted.OverlayPortal(not scaled by map zoom), centred under the widget's transformed bounds, flips above when there's no room below, clamped to the viewport. Its taps share aTapRegiongroup with the field so clicking a button doesn't end editing.ListContinuationFormatter), Enter on an empty item exits the list. Ctrl/Cmd+B and +I toggle inline marks; with a collapsed caret they wrap the word under the caret, or insert****and park the caret inside._TextBoxFrame), and the overlay is outside it, so resize, drag, and defense-side mirroring behave as before.EditorToolbarButtongained anactiveflag: the glyph turns violet (DESIGN.md: violet on an icon means checked), no fill.One test removed:
canonical_coordinates_testasserted the live card height equalsPlacedMediaGeometry.legacyTextFootprintInWorld. That formula only feeds the one-time canonical-coordinates migration and models the oldTextFieldcard; the runtime mirrors from live measurement, and the new card (text + 12px padding, no Material chrome) is a different height at the same font, so the two can't stay equal by design. Shout if you'd rather I pin the card to the old footprint instead.Screenshots (Linux run)
Editing, bar below the widget, markers dimmed, active kind in violet:
Same widget not editing (same card height):
Rendered after focus loss, after a resize:
Heading + numbered list + inline bold rendered:
Defense side (mirrored), formatting intact:
Exported screenshot (camera button) crop:
Video walkthrough is in the first comment.
Tests
test/text_markup_test.dart,test/formatted_text_view_test.dartnew;test/text_widget_resilience_test.dartextended (enter editing, draft, commit on blur).fvm flutter analyzeclean for touched files; targeted suite+42 passed.Link to Devin session: https://app.devin.ai/sessions/dc7ec45e6e12464494017e5ba546e542
Open in Devin Desktop: https://app.devin.ai/desktop/session/dc7ec45e6e12464494017e5ba546e542?variant=devin
Requested by: @SunkenInTime
The verified formatting and text-editing behaviors are safe to merge.
What we checked:
Summary
This change adds Markdown-style formatting for text notes while retaining the original plain-text source for editing. Verified text editing flows save drafts on blur and disposal, list editing exits and renumbers correctly, and drag-feedback and screenshot views render formatted content without exposing Markdown markers. No defects requiring changes were found.
Reviews (4) · Last reviewed commit: "fix(text): carry the caret past earlier ..."