Skip to content

Widget richtext#7162

Merged
martinjagodic merged 72 commits intodecaporg:mainfrom
poslovnimediji:widget-richtext
Mar 24, 2026
Merged

Widget richtext#7162
martinjagodic merged 72 commits intodecaporg:mainfrom
poslovnimediji:widget-richtext

Conversation

@demshy
Copy link
Copy Markdown
Member

@demshy demshy commented Mar 27, 2024

Summary
This is a work-in-progress PR that adds richtext-widget as a potential replacement for the markdown in one of the future releases. Discussion where I put some of my thoughts about this here: #6905
Digging deeper, there might be another caveat that we haven't considered before - nesting block types (inside lists for example) might make the implementation much more difficult so I did not go down that road yet.

A very rough checklist:

  • create new widget and install Plate
  • inline marks (bold, italics, and code)
  • headings
  • number and bullet lists
  • quote block
  • links
  • editor components / shortcodes
  • toggle markdown view
  • images
  • (new/bonus) tables
  • (new/bonus) drag&drop blocks

I have copied serializers (and their tests) from the existing markdown widget and am updating them as I go. I copy the renderers one by one as I get to the plugin in question.
Once the basic implementation is done, I plan on going through the e2e tests and update what is needed on the code or tests side, depends on the specific situation.

Note that this is very much in progress but I'm happy of any feedback, especially from someone who dealt with Slate/Plate before.

Test plan

Checklist

Please add a x inside each checkbox:

A picture of a cute animal (not mandatory but encouraged)

@demshy demshy force-pushed the widget-richtext branch from bcd8f04 to 181d644 Compare April 4, 2024 13:28
RaphaelBossek added a commit to RaphaelBossek/decap-cms that referenced this pull request Dec 1, 2024
@demshy demshy mentioned this pull request Oct 1, 2025
1 task
<Toolbar
onLinkClick={handleLinkClick}
onToggleMode={handleToggleMode}
buttons={[]}
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.

This is hardcoded to be an empty array, I don't think it was meant to be this way?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fixed

Comment on lines +99 to +104
<LinkToolbarButton
type="link"
label={t('editor.editorWidgets.markdown.link')}
icon="link"
disabled={disabled}
t={t}
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.

Is the link button meant to be always visible?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no, fixed

Comment on lines +115 to +126
<ListToolbarButton
type="ul"
label={t('editor.editorWidgets.markdown.bulletedList')}
icon="list-bulleted"
disabled={disabled}
/>
<ListToolbarButton
type="ol"
label={t('editor.editorWidgets.markdown.numberedList')}
icon="list-numbered"
disabled={disabled}
/>
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.

Same here for the lists, just in case!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fixed

t={t}
/>
<HeadingToolbarButton isVisible={isVisible} disabled={disabled} t={t} />
{isVisible('blockquote') && (
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.

The schema uses 'quote' instead of 'blockquote', shouldn't these match?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fixed

<Plate editor={editor} onChange={handleChange}>
<EditorControlBar>
<Toolbar
onLinkClick={handleLinkClick}
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.

I saw this is being passed but is not used

Copy link
Copy Markdown
Contributor

@yanthomasdev yanthomasdev left a comment

Choose a reason for hiding this comment

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

I needed to make a few changes for strikethrough and blockquote to finally work, I can't commit directly so I ported my edits to suggestions.

I'll note that images and the containarized markdown/richtext don't work in the preview, so maybe we could leave these for a follow-up PR with tables and drag-in-drop?

The code block one does work, but has no syntax highlighting nor styling just like blockquote. I guess we would want to add shiki to add styling to it? Not sure how in this context.

@yanthomasdev
Copy link
Copy Markdown
Contributor

I am not sure why unit tests are failing here but not locally, maybe the branch isn't updated? I don't have write access to do that myself.

@yanthomasdev
Copy link
Copy Markdown
Contributor

yanthomasdev commented Mar 20, 2026

@martinjagodic I think this one is basically good to go.

I made a few changes since we last talked:

  • Skipped the failing media library tests (we can keep them and remove in the future, or reevaluate and fix their flakiness another time)
  • Fixed Markdown/Richtext containers that previously weren't rendering in the preview, and also avoiding them from being nested (Richtext Container inside another Richtext Container) which was causing some issues.
  • Fixed a blank Markdown Container rendering "undefined" in the preview.
  • Added missing styles to the preview pre and code elements.
  • Made so the mode switch isn't added inside the Richtext/Markdown Container, since it would be weird to have Richtext mode, on a Markdown container and the fact it was causing some rendering issues as well.

What I wasn't able to solve to this moment is the images not working. Not sure if it's a local thing, or happens in production as well, would need your experience here. We can remove the image attachment if that makes sense.

martinjagodic
martinjagodic previously approved these changes Mar 24, 2026
@martinjagodic martinjagodic merged commit 568cb23 into decaporg:main Mar 24, 2026
9 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.

4 participants