Very excited about blocks in rich text. However, I quickly found something unexpected.
I'm trying to use a
transcript
block inside Lexical Rich Text field. The
transcript
block has only one
lines
field which is also a block field (which can contain
cue
or
line
blocks).
I can create a
transcript
block without problems, but I can't add blocks to its
lines
field.
I'm tried in a minimal setup using create-payload-app, changing the RTE to Lexical, and adding the following
transcript
block:
export const transcriptBlock: Block = {
slug: "transcriptBlock",
labels: { singular: "Transcript", plural: "Transcripts" },
fields: [
{
name: "lines",
type: "blocks",
required: true,
admin: { initCollapsed: true },
blocks: [
{
slug: "lineBlock",
labels: { singular: "Line", plural: "Lines" },
fields: [
{
name: "content",
type: "richText",
required: true,
},
],
},
{
slug: "cueBlock",
labels: { singular: "Cue", plural: "Cues" },
fields: [
{
name: "content",
type: "textarea",
required: true,
},
],
},
],
},
],
};
I also have a collection to test the RTE called
Posts
export const Posts: CollectionConfig = {
slug: "posts",
admin: {
useAsTitle: "title",
},
fields: [
{ name: "title", type: "text", required: true },
{ name: "content", type: "richText" },
],
};
I'll open a GitHub issue later today, unless someone points out a blatant mistake.
That does look like an issue. Could you open a GitHub issue for that? Just makes it easier to keep track of it!
Thanks for the reply Alessio, here:
https://github.com/payloadcms/payload/issues/3531Sorry I didn't have the time to make a fork and have a reproduction ready tonight 🙇♂️
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.