Skip to content

fix(richtext): preserve block images in list items - #7896

Merged
martinjagodic merged 2 commits into
decaporg:mainfrom
marthesselink:7895-fix-richtext-list-shortcodes
Jul 23, 2026
Merged

fix(richtext): preserve block images in list items#7896
martinjagodic merged 2 commits into
decaporg:mainfrom
marthesselink:7895-fix-richtext-list-shortcodes

Conversation

@marthesselink

Copy link
Copy Markdown
Contributor

Summary

Fixes #7895.

Configure Plate's classic list plugin to accept shortcode children. Decap represents block editor components, including the built-in image component, as shortcode nodes. Without this configuration, Plate's list normalizer removes an image nested in a list item when the visual editor initializes, and the next save persists that data loss.

This change:

  • preserves block images nested in list items;
  • adds a regression test for the Markdown parse, normalize, and serialize round trip;
  • maps Plate's React entry points in Jest and allows the nested ESM dependencies needed by that test.

Reproduction

Opening and saving this Markdown in the rich-text editor:

1. First step.
2. Last step.

   ![Screenshot](/img/screenshot.png)

previously produced:

1. First step.
2.

The regression test fails with that exact output before the fix and preserves the original Markdown after the fix.

Test plan

  • npx jest packages/decap-cms-widget-richtext/src/RichtextControl/VisualEditor.spec.js --runInBand
  • npx jest packages/decap-cms-widget-richtext --runInBand
  • npm run format
  • npm run test
  • npm run build

Checklist

  • I have read the contribution guidelines.
  • I have added a regression test for the bug fix.
  • I have linked the issue fixed by this pull request.

@marthesselink
marthesselink marked this pull request as ready for review July 22, 2026 16:38
@marthesselink
marthesselink requested a review from a team as a code owner July 22, 2026 16:38

@yanthomasdev yanthomasdev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM! Thanks!

@martinjagodic
martinjagodic enabled auto-merge (squash) July 23, 2026 06:40
@martinjagodic
martinjagodic merged commit 8f23db0 into decaporg:main Jul 23, 2026
6 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.

Rich text editor deletes block images nested in list items on open/save

3 participants