Skip to content

fix: clamp End alignment firstLine to 0 instead of falling back to Start#683

Merged
MohamedRejeb merged 1 commit intomainfrom
1.x
Apr 24, 2026
Merged

fix: clamp End alignment firstLine to 0 instead of falling back to Start#683
MohamedRejeb merged 1 commit intomainfrom
1.x

Conversation

@MohamedRejeb
Copy link
Copy Markdown
Owner

Images with an intrinsic width larger than the BasicRichText container used to overflow because the inline-content Placeholder was sized upfront from the painter's intrinsic size with no awareness of the container.

BasicRichText now captures its laid-out width via Modifier.onSizeChanged and publishes it through an internal LocalRichTextMaxImageWidthProvider. The Image inline content reads that value and scales width/height proportionally (aspect ratio preserved) when the intrinsic width exceeds the container. The LaunchedEffect is keyed on the container width so resizes trigger a re-clamp.

Fixes: #423

Images with an intrinsic width larger than the BasicRichText container
used to overflow because the inline-content Placeholder was sized upfront
from the painter's intrinsic size with no awareness of the container.

BasicRichText now captures its laid-out width via Modifier.onSizeChanged
and publishes it through an internal LocalRichTextMaxImageWidthProvider.
The Image inline content reads that value and scales width/height
proportionally (aspect ratio preserved) when the intrinsic width exceeds
the container. The LaunchedEffect is keyed on the container width so
resizes trigger a re-clamp.

No public API change — the CompositionLocal is internal. Scoped to
BasicRichText only; the editor path is untouched.
@MohamedRejeb MohamedRejeb merged commit d7f53e1 into main Apr 24, 2026
2 of 3 checks passed
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.

Image stretches outside of container

1 participant