Skip to content

Attributed editing: rich-textarea + text_attr (refs #413) - #414

Open
alextingiris wants to merge 2 commits into
vercel-labs:mainfrom
alextingiris:feat/attributed-rich-textarea
Open

Attributed editing: rich-textarea + text_attr (refs #413)#414
alextingiris wants to merge 2 commits into
vercel-labs:mainfrom
alextingiris:feat/attributed-rich-textarea

Conversation

@alextingiris

Copy link
Copy Markdown

Summary

  • Paragraph-scoped attributed editing on TextBuffer + parallel style runs (text_attr.zig / @native-sdk/core/text-attr)
  • Markup <rich-textarea> (element code 71) stamps WidgetRuntimeFlags.rich_editor
  • Example examples/rich-textarea + skill-data notes
  • Sketch only: text_doc.zig for a later multi-block milestone

Design discussion: #413

Dogfooded in Tonic desktop via NATIVE_SDK_PATH + TONIC_NATIVE_RICH_EDITOR=1 (Source + Bold/Italic/Strike + GFM preview; Lexical remains full-GFM).

Test plan

  • zig test src/primitives/canvas/ui_schema_tests.zig (pins updated for element 71)
  • Tonic native check with NATIVE_SDK_PATH (subset checker clean)
  • scripts/gate.sh fast on this branch (local Zig 0.16; unsigned commit — signing not configured on this machine)
  • Manual: native run examples/rich-textarea — type, select, Bold/Italic, undo text
  • Review capacity / a11y notes in Attributed editing: paragraph-scoped rich-textarea on TextBuffer + TextSpan #413 before expanding paint path

Made with Cursor

TextBuffer stays the byte SoT; parallel style runs map through edits and
paint via TextSpan. Expose <rich-textarea>, @native-sdk/core/text-attr,
and a dogfood example. Refs vercel-labs#413.

Co-authored-by: Cursor <cursoragent@cursor.com>
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

@alextingiris is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

end = end - del_len + inserted_len;
} else {
// overlaps deleted range
if (start < del_start) {

@vercel vercel Bot Aug 30, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapStyleRunsThroughReplace drops the tail of a style run that fully contains the deleted range, so mid-run editing strips styling from the caret to the end of the run.

Fix on Vercel

Carry StyleRuns through styles= into glyph paint, register text-attr/text-doc
SDK modules for subset builds, and ship a rich-document example with split/merge.

Co-authored-by: Cursor <cursoragent@cursor.com>
text_color;
const baseline_y = origin.y - scroll_y + run.baseline;
const origin_pt = pixelSnapTextPoint(tokens, geometry.PointF.init(origin.x + run.x, baseline_y));
const slot: ObjectId = 40 + @as(ObjectId, @intCast(@min(ordinal, 200)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emitRichEditorWidget uses draw-command slot values (40/80/120 + ordinal) that exceed the 16-slot-per-widget part-id budget, causing ObjectId collisions with neighboring widgets and with its own decoration parts.

Fix on Vercel

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

Successfully merging this pull request may close these issues.

1 participant