Hey, the public-demo examples have been very helpful and much appreciated. However there doesn't appear to be a custom leaves example on the project?
Documentation mentions that there would be custom leaves example too: https://payloadcms.com/docs/fields/rich-text#building-custom-elements-and-leaves
For more examples regarding how to define your own elements and leaves, check out the example [RichText field](https://github.com/payloadcms/public-demo/blob/master/src/fields/hero.ts) within the Public Demo source code.
I've tried adapting the custom element examples to leaves, but I'm unable to affect how the rich text editor renders the text (my leaf applied) in editor. Buttons are working.
I'm trying to add text alignment buttons/leaves, and would probably need to add style property text-align
to the affected entity in rich editor. The leaf however appears to affect the JSON output correctly.
So yea.. appears elements and leaves work very similarly indeed. Found a typo which wasn't causing any issues, except that made the custom leaf/element work only partially. Case closed.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.