Overview
There are requests to make the redux field widgets work with widgets such as the formatted text one used by TextLongItem, but there is currently no way to add a prop that uses such a widget, so we need to get that working before reduxing it can be explored
This will be supported once #3467959: SDC and code component props should be able to receive HTML, editable in formatted text fields+widgets is taken care of.
Proposed resolution
Make the block HTML prop shapes in the wysiwyg-ptops component from the sdc_test_all_props module load CKEditor 5, rather than just <textarea>:
Do that by:
- ✅ updating
/** * No-op transform for rich text fields with CKEditor 5 integration. * Simply passes through the value without transformation. * * @todo Add actual logic in https://www.drupal.org/i/3512867 */ const richText: Transformer<void, any> = (value) => { return value; };—
ui/src/utils/transforms.ts— added by #3467959: SDC and code component props should be able to receive HTML, editable in formatted text fields+widgets(or deleting it if it's obsolete)
- ✅ Adding end-to-end test coverage to
ui/tests/e2e/prop-types.cy.js— with AI-generated tests already present, but no idea how good they are. See
// @todo Uncomment this test in https://www.drupal.org/i/3512867 and refactor as needed. /* it('HTML inline formatting field uses CKEditor with appropriate configuration', () => {
User interface changes
CKEditor 5 is available in the right sidebar for some component props!

| Comment | File | Size | Author |
|---|---|---|---|
| #32 | CKE5 in component instance form.gif | 107.43 KB | wim leers |
| #13 | Screenshot 2025-04-21 at 5.49.45 PM.png | 164.77 KB | bnjmnm |
Issue fork experience_builder-3484395
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
wim leersComment #4
wim leersComment #5
bnjmnmNot much point working on this until we can get CKEditor 5 loading on textareas #3512867: CKEditor 5 not loading on formatted text Field Widgets in the content entity form so postponing on that
The current MR is outdated to the point that it's probably not worth continuing, and will likely be less relevant after #3512867 so I'm going to hide that one and recommend a new MR starts once we have CKEditor 5 working in the fields that are configured to use it. #3512867 already has it the editor properly loading with formatted text fields in the Page Data form
Comment #8
wim leers#5++ — thanks so much for assessing and summarizing this issue's status, @bnjmnm! 🙏😊
Per #3512867-11: CKEditor 5 not loading on formatted text Field Widgets in the content entity form, retitling this to more precisely reflect this issue's scope.
Comment #9
wim leers#3467959: SDC and code component props should be able to receive HTML, editable in formatted text fields+widgets is in.
I reviewed #3512867 to help it land: #3512867-14: CKEditor 5 not loading on formatted text Field Widgets in the content entity form.
Comment #10
wim leersThis issue/MR will update bits and pieces #3467959 introduced; making that clear in the issue summary.
Comment #11
wim leers#3512867: CKEditor 5 not loading on formatted text Field Widgets in the content entity form is in!
Comment #12
wim leersComment #13
bnjmnmMR has it working, still need to add tests.
Comment #15
wim leers#13: exciting! 😄🤩
Comment #16
wim leersNote: the "inline" ones don't need to work, as described in #3517735: [later phase] [needs upstream feature] Make `x-formatting-context: inline` work. Sorry for making that not more clear, @bnjmnm :(
(It was kind of mentioned in #3519910, but I just made that more explicit: #3519910-3: [META] WYSIWYG in Experience Builder.)
Comment #17
bnjmnmThere are PHP tests failing due to there being commented-out props in the all-props sdc. These are props unrelated to the work happening here, but their presence results an error occurring any time a value changes on any prop in all-props. It is being worked on in this issue: #3467959: SDC and code component props should be able to receive HTML, editable in formatted text fields+widgets
They're commented for now so the work being done here can be reviewed manually and the CK5 e2e tests pass. That should be enough to get this reviewed, but we shouldn't commit until #3467959 lands and we un-comment those props.
Comment #18
wim leers🏓 Review posted!
That issue is closed, so did you perhaps intend to link to another issue?
Comment #19
bnjmnm\
This turned out to be a pretty big thing to address, but it's good this came up and I have the underlying issue fixed. Instead of relying on Drupal behaviors, this is now using the Ckeditor5 React Integration.
Now the editors work without flickering and the preview updates as you'd expect. However, I've been at this for far too long and the code is a bit scary looking so it's switched to draft. There's some cleanup + the format switching will need to be refactored a bit to work with the React-rendered CKEditor5 components. I think this is for the best as CKEditor5 is probably too complex to graft the Vanilla JS version onto our React forms if there's an official React solution available.
I'm unassigned myself in case someone wants to jump into the chaos, but I'll be back at it tomorrow.
Comment #20
bnjmnmSorry @ anjali your name is right next to "Unassigned"
Comment #21
bnjmnmThe flickering reported earlier wound up being a pretty big deal and I switched out the drupalBehaviors grafting to instead use the React solution from CKEditor themselves.
The only failing e2e test is the recently added
field_xbt_entity_ref_tagswhich was added to day and should(?) be unrelated to anything here.The MR should probably have gotten another once over from me before switching to NR, but I gotta leave the computer + this is high priority and probably good to get some eyes on it
Comment #22
bnjmnmPausing the NR - spotted something locally that could be improved
Comment #23
bnjmnmComment #24
wim leers@larowlan already did a detailed review, so I won't :)
I want to zoom out and look at what our intent/hope is with ("keep existing widgets working without significant changes") versus the reality here:
Then again, CKEditor 5 is a massively complex application on its own, which Drupal's been embedding, and now we're embedding it into XB, another complex app on its own!
So: can we be confident that this deep special-casing will be only necessary for very complex widgets like this one? Is it extra complex because we're only going to allow these 2 specific locked text formats/editors in component instances? IOW: can we document why this is so complex and special? 🙏 A new section in
docs/redux-integrated-field-widgets.mdperhaps?Comment #25
bnjmnmMaybe this should be a separate issue? This is higher level than just CKEditor5 , and our decision to use Radix has necessitated far more complexity than anything in this issue.
I also think this is based on an assumption that this introduces unprecedented special-casing which I don't really think it does.
No, nothing in the React or semi coupled code was any more/less complex because of the that. It just works with whatever is made available to it.
There was additional complexity due to the design decision to hide the format select element behind a popup and render that element with Radix instead of making it a standard select.
I still don't think this stands out as novel in its complexity
If documenting additional complexity in the Render Array -> React layer seems beneficial, justifying the complexity introduced by Radix should probably get the emphasis, which would be out of scope here. I think this could be worthwhile to do in a separate issue.
Comment #26
wim leersIt is a higher-level question, indeed, but it is prompted by this MR adding a lot of extra JS code to make the "formatted text" Field Widget work within XB. That's why I'm asking for documentation in
docs/redux-integrated-field-widgets.mdso that somebody who joins the Experience Builder project might be able to learn/understand how all this fits together, and why for certain field widgets extra work/complexity is justified.I was hoping this would be a first case where a complex widget can be shown to be made to work without significant JS work, similar to what we've been saying how we want contrib/custom field widgets to work in XB. That's where this concern/question is coming from — it's not that this isn't great work (it is! 😄), but that this gives me pause for how we can expect our approach to scale to the entire field widget ecosystem.
I understand that that feels like a distraction/is technically out of scope. But isn't expanding
docs/redux-integrated-field-widgets.mdwith one concrete advanced example, on the MR that is introducing said example … reasonable? 😅 Moving it to a follow-up makes no sense to me, because writing docs later will cause loss of insight, and the act of writing the docs might result in improvements? 😊😞 I did not know that. I don't see anything about that in either
docs/redux-integrated-field-widgets.mdnordocs/shape-matching-into-field-types.md.IIRC this was not really a design decision, but just a choice @balintbrews made many months ago because we didn't have designs!
I'll review the back-end pieces of this MR. But my concerns above WRT FE pieces still exist. I do fully acknowledge most of this is a black box to me already, but I've been able to conceptually reason about it. This MR makes
If @larowlan, @effulgentsia and @balintbrews are comfortable with this landing without docs, then great!
Comment #27
wim leersPer #26. Back-end review completed.
Manual testing: this works beautifully! 🤩
Self-addressed all my remarks, except for two: 1, 2.
Comment #28
wim leersDoes this need review from me, @bnjmnm? 😇 Would like to land this one! :D
Comment #29
bnjmnmNot yet. #24 & #26 opened a can of worms and this will be another few days at least, potentially longer depending on how many rounds of revisions are requested on the docs.
Comment #30
bnjmnmUpon discovering that much of the implementation I was fighting against was done due to lack of designs vs something intentional, I gutted it and replaced it with something that required fewer hacks & workarounds. It's not suddenly simple, but all the steps are very clearly geared towards the implementation the CK team's CKEditor 5 React component, instead of wiring disparate parts together.
Functionally this is basically ready to go (I'm sure there will be some changes requested in review) but the following need to be considered
Current Limitations
Documentation Needs
This could take a while for a few reasons
Comment #31
bnjmnmAdded two followups
Comment #32
wim leersAiming for RTBC since it was so very close in #27 already!
Removing tag, that's now going to be handled in #3522999: Document use cases where XB's field widgets don't 1:1 match how they would work in a twig theme.
daterange_defaultdetour@bnjmnm must've been testing with the (optional)
daterangemodule installed and hence ran into a one-line logic bug introduced by #3515629: FieldWidget's XB transforms must be bubbled by the Field Widget rendering to inform the client. To get past that, he defined an empty client-side transform for thedaterange_defaultwidget, which then resulted in it being claimed to be working in\Drupal\Tests\experience_builder\Kernel\EcosystemSupport\FieldWidgetSupportTest, which then undermined the value/meaningfulness of that test … because it doesn't actually work (and I spent ~30 minutes debugging and trying to get it to work, which is why there's now a detailed analysis of where it goes wrong) 😅To avoid that information to go to waste: #3523379: [later phase] Support `daterange_default` field widget in component instance form.
Manual testing
Works great! 🤩
Comment #34
wim leersArgh, can't merge because
package-lock.jsonwas just updated in #3516390: Compile Tailwind CSS globally for code components. Can you do that, @bnjmnm? 🙏Comment #35
wim leersMaking #31's follow-ups findable.
Comment #37
wim leers🥳