Replies: 3 comments 2 replies
-
Hey @ssyberg — we actually have a few different ways that you can do this! Statamic's approach is basically a glorified "rich text". This can be good in certain simple scenarios and Payload's Rich Text Editor can do the exact same thing. However, Statamic's is built with ProseMirror and outputs HTML, while Payload's is built with SlateJS and outputs structured data as JSON. Payload's We plan on releasing guides that detail specifically how to build your own elements and leaves, but for now, you can look at our SlateJS also has a little set of examples which range from simple to complex. Specifically, the Editable Voids example might be relevant to you. What's great is that any work you put into building your own Payload rich text elements and leaves is really just learning SlateJS - Payload's abstractions are very minimal... meaning you won't have to waste any time learning how to do things the Payload way. If you have any questions, bring them on! |
Beta Was this translation helpful? Give feedback.
-
Totally get this, and the SlateJS extensibility is pretty sweet as is the json output! I think one of the main goals of bard/this idea would be to not have to replicate the work of defining a block / "fieldset" in one place in Payload and then also create a custom element/component for SlateJS that represents the same structure (and all the normal pitfalls of not being DRY would apply). Perhaps there's an easy way to import a block/fieldset in to a react component for use in Slate with minimal additional code that keeps the implementation relatively DRY, but I'm pretty new to react so don't have my head wrapped around that yet. |
Beta Was this translation helpful? Give feedback.
-
I think so! I just need to mull this over a bit more. FWIW I'm not a huge fan of the edit in place / Gutenberg style editors and we're specifically looking for solutions where we're very prescriptive / explicit about blocks or content sections that the content editor has lots of control over (and we want to keep this to a minimum). The edit-in-place/Gutenbergs out there tend to be too flexible in our opinion and tend to lead to a breakdown of the designs. It's a fine balance and very few CMS solutions have pulled this off. But I digress... One of the nicest features of the Statamic Bard - and really the impetus around suggesting this be a rich text editor feature and not just blocks is the ability to easily move these "inline blocks" around within the surrounding text (and other in line blocks). Currently if I have a text block followed by an image block followed by a text block and I want to move the image up one paragraph, I have to copy the paragraph from one text block to the other (and this is the paradigm in all the block sections of every CMS that supports blocks with the exception of the Statamic Bard). This is a trivial example, but hopefully the implication is a little more clear / how powerful this would make the RTE. |
Beta Was this translation helpful? Give feedback.
-
Similar to the Statamic bard? https://statamic.dev/fieldtypes/bard?ref=docs.statamic.com
Beta Was this translation helpful? Give feedback.
All reactions