Has someone made a custom codeblock element to the rich text editor?
I wanted to trigger a leaf while adding the type and ended up with this
const ToolbarButton: React.FC<{ path: string }> = () => {
return (
<ElementButton format="code-block">
<LeafButton format="code">Code</LeafButton>
</ElementButton>
);
};
export default ToolbarButton;
wonder if this is a good practice solution at all.
This might give you some ideas:
https://github.com/payloadcms/rich-text-with-markdownThank you for a quick reply.
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.