Skip to content

docs: document non-obvious embed behavior in custom_embed_blocks - #2761

Open
beeswaxpat wants to merge 1 commit into
singerdmx:masterfrom
beeswaxpat:docs-embed-gotchas
Open

docs: document non-obvious embed behavior in custom_embed_blocks#2761
beeswaxpat wants to merge 1 commit into
singerdmx:masterfrom
beeswaxpat:docs-embed-gotchas

Conversation

@beeswaxpat

Copy link
Copy Markdown

Description

Adds a "Behavior that is easy to miss" section to doc/custom_embed_blocks.md covering four things the API does not make obvious, each verified against master:

  • EmbedContext.node is detached for custom embeds (text_line.dart re-creates the node via CustomBlockEmbed.fromJsonString), so node.documentOffset is unusable there, while plain embeds such as images keep the attached node. Documents the correct ways to locate the embed.
  • EmbedBuilder.expanded controls block vs inline rendering; expanded => false routes a single-embed line through the inline WidgetSpan path so text can share the line.
  • Sizing an embed works only through the style attribute (ResolveImageFormatRule accepts only that key); WidthAttribute/HeightAttribute throw FormatException in formatText, and a try/catch turns that into a silent no-op.
  • Keying editable embed widgets by a stable id so their state survives the rebuild a replaceText commit triggers.

Docs only, no code changes.

Related Issues

None.

Type of Change

  • 📝 Documentation: Updates or additions to documentation.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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