Skip to content

fix: strip inline-content placeholder char from image serialization#686

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

fix: strip inline-content placeholder char from image serialization#686
MohamedRejeb merged 1 commit intomainfrom
1.x

Conversation

@MohamedRejeb
Copy link
Copy Markdown
Owner

No description provided.

`state.toHtml()` emitted the raw inline-content placeholder (U+FFFD)
HTML-encoded inside the `<img>` tag, producing output like
`<img src="...">&#65533;</img>`. The generic span-to-HTML decoder was
appending `richSpan.text` as inner content, but Image spans carry the
placeholder char in raw text (see #466) so span textRanges line up
with the rendered annotated string. Recognize Image as an HTML void
element: emit the open tag and return immediately, no content, no
closing tag.

`state.toMarkdown()` fell through the `else -> text` branch for Image
spans, emitting the placeholder char directly and no `![alt](url)`
syntax at all. Add an Image case to `decodeMarkdownElementFromRichSpan`
emitting `![contentDescription](model)` when `model` is a String.
Non-String painter models have no representable form in Markdown and
are dropped.

Adds commonTest/ImageSerializationTest with 6 regressions covering the
placeholder char, tag shape, and round-trip preservation for both
HTML and Markdown.
@MohamedRejeb MohamedRejeb merged commit 15c8f97 into main Apr 24, 2026
2 of 3 checks passed
renovate Bot added a commit to r0adkll/Campfire that referenced this pull request Apr 27, 2026
…1.0.0-rc14 (#755)

This PR contains the following updates:

| Package | Change |
[Age](https://docs.renovatebot.com/merge-confidence/) |
[Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
|
[com.mohamedrejeb.richeditor:richeditor-compose](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor)
| `1.0.0-rc13` → `1.0.0-rc14` |
![age](https://developer.mend.io/api/mc/badges/age/maven/com.mohamedrejeb.richeditor:richeditor-compose/1.0.0-rc14?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.mohamedrejeb.richeditor:richeditor-compose/1.0.0-rc13/1.0.0-rc14?slim=true)
|

---

> [!WARNING]
> Some dependencies could not be looked up. Check the [Dependency
Dashboard](../issues/15) for more information.

---

### Release Notes

<details>
<summary>MohamedRejeb/Compose-Rich-Editor
(com.mohamedrejeb.richeditor:richeditor-compose)</summary>

###
[`v1.0.0-rc14`](https://redirect.github.com/MohamedRejeb/compose-rich-editor/releases/tag/v1.0.0-rc14)

#### What's Changed

- Migrate project to Java 17, Gradle 9.0, Kotlin 2.3.20, Compose 1.10.3
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#647](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/647)
- feat: rich text copy/paste support by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#650](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/650)
- Fix StringIndexOutOfBoundsException for Rich Text Editor by
[@&#8203;rguzman1-godaddy](https://redirect.github.com/rguzman1-godaddy)
in
[MohamedRejeb/compose-rich-editor#638](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/638)
- Add comprehensive OffsetMapping tests for RichTextState operations by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#651](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/651)
- Support `start` attribute for ordered lists in HTML parsing and
rendering by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#653](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/653)
- Fix HTML parsing for line breaks within paragraphs by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#654](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/654)
- Fix `<br>` handling in inline elements and preserve parent span styles
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#655](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/655)
- fix: handle IME revert, selection replacement, and cross-paragraph
prefix removal by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#658](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/658)
- fix: typing garbled next to image spans
([#&#8203;466](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor/issues/466))
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#661](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/661)
- fix: preserve \* bullet markers in markdown input
([#&#8203;637](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor/issues/637))
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#663](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/663)
- feat: add minLines parameter to material3 RichText
([#&#8203;643](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor/issues/643))
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#670](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/670)
- feat: add mentions/triggers with atomic token spans
([#&#8203;45](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor/issues/45),
[#&#8203;252](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor/issues/252))
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#671](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/671)
- feat: implement undo/redo history system for rich text editor by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#673](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/673)
- Fix indent for orderedlist paragraph by
[@&#8203;DavidPerezP124](https://redirect.github.com/DavidPerezP124) in
[MohamedRejeb/compose-rich-editor#636](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/636)
- fix: preserve dot-aligned list indent while keeping prefix visible by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#677](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/677)
- feat: add ListMarkerStyleBehavior to control list marker style
inheritance by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#678](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/678)
- feat: add ListPrefixAlignment for customizable list marker alignment
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#680](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/680)
- fix: keep raw text and list prefixes in sync on config change by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#681](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/681)
- fix: clamp End alignment firstLine to 0 instead of falling back to
Start by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#682](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/682)
- fix: stabilize inline images across rebuilds (RichSpanStyle.Image) by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#685](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/685)
- fix: strip inline-content placeholder char from image serialization by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#686](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/686)
- sample: add Images and Links sample screens showcasing rich text
editor capabilities by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#687](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/687)
- sample: add GitHub demo screen and other improvements by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#690](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/690)
- fix: rebuild annotated string on selection change when mask applies
([#&#8203;635](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor/issues/635))
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#691](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/691)
- Feature/mention click by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#692](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/692)
- Implement Heading Styles (H1-H6) by
[@&#8203;DevinDuricka](https://redirect.github.com/DevinDuricka) in
[MohamedRejeb/compose-rich-editor#589](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/589)
- test: add unit tests for `RichTextState.setText` preserving raw text
literals by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#695](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/695)
- test: add unit tests for Markdown parser's bold-italic bullet handling
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#696](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/696)
- fix: emit blank line before list block in markdown decode
([#&#8203;441](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor/issues/441))
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#697](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/697)
- sample: add Claude-themed demo with rich text commands and streaming
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#698](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/698)
- fix: cache list prefix widths to avoid first-frame indent flicker by
[@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#699](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/699)
- feat: add ExpandableBasicRichText with inline see more / see less
([#&#8203;450](https://redirect.github.com/MohamedRejeb/Compose-Rich-Editor/issues/450))
by [@&#8203;MohamedRejeb](https://redirect.github.com/MohamedRejeb) in
[MohamedRejeb/compose-rich-editor#701](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/701)

#### Some screenshots from sample:

<img width="796" height="569" alt="Screenshot 2026-04-26 at 10 53 32 PM"
src="https://github.com/user-attachments/assets/6bce5ab6-46ef-4037-bc74-6943fe912cb1"
/>
<img width="797" height="568" alt="Screenshot 2026-04-26 at 10 53 58 PM"
src="https://github.com/user-attachments/assets/76a207e0-a34c-40d2-9a3e-5bff06bf717e"
/>
<img width="796" height="568" alt="Screenshot 2026-04-26 at 10 55 33 PM"
src="https://github.com/user-attachments/assets/20bd1bbd-b954-4967-b44c-caee39730aa4"
/>

#### New Contributors
* @&#8203;rguzman1-godaddy made their first
contributi[https://github.com/MohamedRejeb/compose-rich-editor/pull/638](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/638)ll/638
* @&#8203;DavidPerezP124 made their first
contributi[https://github.com/MohamedRejeb/compose-rich-editor/pull/636](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/636)ll/636
* @&#8203;DevinDuricka made their first
contributi[https://github.com/MohamedRejeb/compose-rich-editor/pull/589](https://redirect.github.com/MohamedRejeb/compose-rich-editor/pull/589)ll/589

**Full Changelog**:
<MohamedRejeb/compose-rich-editor@v1.0.0-rc13...v1.0.0-rc14>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/r0adkll/Campfire).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNDEuMyIsInVwZGF0ZWRJblZlciI6IjQzLjE0MS4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZSJdfQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.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