dgourdet
(David Gourdet)
March 25, 2025, 1:31pm
1
Hello,
I don't understand why my custom style in the Rich Text editor in one slice section of my website is not reachable, but is reachable in another section.
I have this config:
{
"id": "introWithRichText",
"name": "Intro avec texte riche",
"docURL": "...",
"version": "initial",
"description": "Default",
"imageUrl": "",
"primary": {
"title": {
"type": "StructuredText",
"config": {
"label": "Title",
"placeholder": "",
"allowTargetBlank": false,
"single": "heading2",
"labels": ["btn"]
}
},
[...]
When it works:
When it doesn't work:
Thanks a lot for your help,
David
Ezekiel
(Ezekiel Ravidat)
March 26, 2025, 8:21am
2
Hi @dgourdet ,
Would you mind recording a Jam of this behavior so we have more information on what's happening here? It'd be helpful to have eyes on where it works and where it doesn't, to help us troubleshoot. If you don't want to post the Jam publicly on the forum, you can message it to me privately
Ezekiel
(Ezekiel Ravidat)
March 26, 2025, 12:42pm
4
Thanks for the Jam!
I believe you need to allow some more formatting options for your rich text field in the Slice Machine. A rich text field with more options than just heading2
for example would have this in its model.json:
"single": "paragraph,preformatted,strong,em,hyperlink,image,embed,list-item,o-list-item,rtl"
And the editing toolbar would pop up then, to allow you to choose which styles you'd like to apply to the text.
Whereas you only have:
"single": "heading2"
Your other rich text field example is probably configured differently. You can read more about this here: Edit Rich Text - Documentation - Prismic and here: Fields - Documentation - Prismic
Let me know if I can clarify anything else for you!
dgourdet
(David Gourdet)
March 26, 2025, 2:21pm
5
Thanks a lot for your quick reply @Ezekiel !
I'm gonna try this!
1 Like
dgourdet
(David Gourdet)
March 26, 2025, 3:28pm
6
Sorry @Ezekiel , I don't know why I spoke about "Rich text" because the concerned fields are simple "Text" ("StructuredText") fields.
In fact, it works inside a custom type with this configuration:
"fields": {
"title": {
"type": "StructuredText",
"config": {
"label": "Title",
"placeholder": "",
"allowTargetBlank": false,
"single": "heading2,em",
"labels": ["btn"]
}
},
but not inside a slice with this configuration:
"title": {
"type": "StructuredText",
"config": {
"label": "Title",
"placeholder": "",
"allowTargetBlank": false,
"single": "heading2",
"labels": ["btn"]
}
},
I've tried to add "em" in the "single" property like this:
"single": "heading2,em",
but it didn't work.
Ezekiel
(Ezekiel Ravidat)
March 26, 2025, 4:10pm
7
Hey @dgourdet , you need to add these options in the Slice Machine and push those changes for it to work, sorry if I was unclear.
Like here:
Selecting those will define what is in that property
dgourdet
(David Gourdet)
March 26, 2025, 7:23pm
8
Thanks a lot Ezekiel!
This is working now!
So if I recap a bit, in order to get my custom style working, I need 2 things:
I need more formatting options for my text field than just a heading
Obviously, I need to push these options (that said, I totally forgot )
1 Like
Ezekiel
(Ezekiel Ravidat)
March 27, 2025, 7:45am
9
Exactly, you got that right
1 Like