You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For context: this is my first time using Payload CMS and the Lexical editor. Please let me know if I made a mistake in usage or explanation!
What am I trying to accomplish?
In the richtext editor I want to add a new type of paragraph, a styled-paragraph under the text dropdown. Which is when rendered is a
<p class="test-class">{some text nodes}<p>
It is practically identitcal to the Paragraph node except for the class.
Any help that either suggest a better way of accomplishing this or improving what I tried is welcome!
What I have
I have pages collection, where blocks can be added.
And a block called Content. These are similar to the pages and content block from the Website Template
I also have the RichText component from there.
What I tried
Block feature
I first tried to add a (inline) block feature. This worked, but it didn't have the desired functionality. The text was not inline and opened a new dialog. It also doesn't seem to support text markup like bold and italic.
Custom node / feature
What I did next is something I wasn't fully prepared for. I tried to create a custom paragraph node and added it using the server and client feature.
When two Styled pagraphs are added with child text nodes it renders this
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
For context: this is my first time using Payload CMS and the Lexical editor. Please let me know if I made a mistake in usage or explanation!
What am I trying to accomplish?
In the richtext editor I want to add a new type of
paragraph
, astyled-paragraph
under the text dropdown. Which is when rendered is aIt is practically identitcal to the
Paragraph
node except for the class.Any help that either suggest a better way of accomplishing this or improving what I tried is welcome!
What I have
I have pages collection, where blocks can be added.
And a block called Content. These are similar to the pages and content block from the Website Template
I also have the RichText component from there.
What I tried
Block feature
I first tried to add a (inline) block feature. This worked, but it didn't have the desired functionality. The text was not inline and opened a new dialog. It also doesn't seem to support text markup like bold and italic.
Custom node / feature
What I did next is something I wasn't fully prepared for. I tried to create a custom paragraph node and added it using the server and client feature.

When two Styled pagraphs are added with child text nodes it renders this

styled-paragraph.server.ts
styled-paragraph.client.ts
StyledParagraphPlugin.tsx
StyledParagraphNode.ts
payload.config.ts
Beta Was this translation helpful? Give feedback.
All reactions