feat: support for embeds - #1
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues. You can view the agent here.
Reviewed by Cursor Bugbot for commit 953814d. Configure here.
| rects: ReadonlyMap<number, EmbedRect>; | ||
| }>({ owner: null, rects: NO_EMBED_RECTS }); | ||
| const rects = | ||
| embedRects.owner === projected ? embedRects.rects : NO_EMBED_RECTS; |
There was a problem hiding this comment.
Overlays vanish after projection swap
High Severity
Embed overlays are keyed to the projected object identity, so any reprojection drops every stored rect. Both hosts only re-fire onEmbedLayout when a rect moves, so unchanged reservations are never re-announced. After a stream settles — or any other re-render that rebuilds projected with the same geometry — the cards never appear.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 953814d. Configure here.
| } | ||
| lastEmbedRects[embed.id] = rect | ||
| emit(embed.id, rect.origin.x, rect.origin.y, rect.width, rect.height) | ||
| } |
There was a problem hiding this comment.
iOS embed events ignore declared size
Medium Severity
iOS onEmbedLayout sends the TextKit boundingRect width and height instead of the declared reservation stored in embed.size. Android echoes the declared size, and the overlay is sized from the event. A measured box that does not match the attachment leaves the card the wrong size on iOS only.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 953814d. Configure here.


Note
High Risk
Changes core selection projection, Yoga/text measurement, and native layout on both platforms; incorrect placeholder or rect handling could break copy mapping or overlay positioning, though coverage is extensive.
Overview
Restores the
embedAPI (removed in 0.10.0) so custom views like citation cards can live inside a prose selection run instead of forcingclassifyBlock: 'standalone'. Consumers return declaredwidth/height, optional copytext, and arenderfunction; claimed nodes project as a single U+FFFC placeholder with exact source mapping, and selection/copy can sweep across them atomically.JS pipeline:
segmentRuns/projectRungainEmbedLookup(wins overclassifyBlockand view-kind standalone rules),ProjectedRun.embeds, and embed marks.resolveRunEmbedsand transparent + line-height attributes reserve layout height;SelectableMarkdownwraps runs with absolutely positioned overlays positioned from reported rects (skipped on unsettled streaming tail).Native contract: New
embedsprop andonEmbedLayoutper embed (deduped rect updates). Android usesRunEmbedSpan/ReplacementSpanand layout-cache keys include embeds; iOS usesRNSMEmbedAttachmenton the shared attributed-string builder. Fabric measurer comments clarify overlays are siblings, not shadow-tree attachments.Quality & release: Corpus-scale embed projection oracle tests, unit tests for segmentation/projection/attributes, codegen checks for embed structs/events, and docs/README updated for 0.11.x. Package version bumped to 0.11.0.
Reviewed by Cursor Bugbot for commit 953814d. Bugbot is set up for automated code reviews on this repo. Configure here.