Hi!
I have a project which I created in my Windows laptop, but now I changed for MacBook (MacBook pro), and when I try to edit one of my custom components fields, and I click on this component all of my default styling will be deleted:
You can see this in action in this video:
Please let me know, why is this happening, have you seen something like that before? (Only breaks in mac, windows working properly, although same Chrome browser)
I am using next.js, and my custom component has richText field, and this field is richText with a defaultValue (which has some styling), for styling I use TailwindCSS, everything worked properly till yesterday, I don’t know what happened, but the richText styling is gone after I click on an item
Like it would override all of my richText style and will be only a simple paragraph tag
But if you see the richText editor, it is buggy. I add default value, eg:
{
name: 'title',
type: 'richText',
defaultValue: `<p className="text-5xl font-semibold leading-10 text-Barion-gray">
The smartest way to pay
</p>`,
},
And so the richText will have this custom css values, but when you click in the richText editor and modify the text, it will override all of the default css, and it will be a plain paragraph, I think that’s the root issue of this styling disappearing problem.
As you can see all of my previous default styling vanishing just by typing in this richText editor, so it is definitely not the expected behaviour in my opinion.
@radikris Thanks for sharing those details. I tried reproducing this issue on my end but haven’t been able to reproduce richText styling breaking on mac. Your Customgrid component also has richText, but I’m not able to reproduce this issue with that element so it seems specific to the Custom hero component. Is there any difference between the way the two components are registered? If you can share a reproduction with codesandbox/stackblitz we can dig in further.
I can say that it is not the issue with mac, I switched back to Windows but the issue is the same:
I can just say, that the richText editor will override the current styling:
You could not see that in the CustomGrid, although it also got overriden:
But the difference between Hero and this CustomGrid
And the hero don’t has any wrapper p element around the html-parser
But still breaks the styling, and I noticed this bug earlier as well, you can add any css class to the richText paragraph element, and if you for example change the color or something it will override it.
Please investigate more on this richText editor field.
I can confirm this behavior. If you add a vanilla text block and add classes via the code view, go back to wysiwyg, shift focus to another element all class attributes will be stripped. Is there something we can configure to turn this off? It’s pretty aggressive
@radikris If you add your styling directly to the default value like pictured above, these styles will be wiped out when you replace your default text. If you want your styles to persist, you can instead add wrapper <div>s to the element that has the relevant classes. So we can investigate any other styles that are removed when editing, can you please provide a reproduction with codesandbox/stackblitz?
Hi @amineo! To confirm, are you referring to editing a default text block, not within a custom component?
@amineo@maddy It doesn’t matter if we are talking about a custom compoknent or a drag and drop richtext editor, if I click on my component and click edit, my cursor automatically will focus the richText editor, and as you said it will wipe out the styles by default although the text will stay the same.
This is the problem with the editor.
I can just link here again my video, I can not emphatise that more:
@maddy@radikris – Yes, the richText editor seems to strip styles regardless if its from the standard Builder Text block component or from a custom component. When the rich text editor loses focus/regains focus it strips all class attributes. @radikris videos above illustrate this.
Expedited result is to keep the class attribute
<strong class="text-highlight">Some Text</strong>
Whats happening is the class attribute gets removed
@radikris@amineo Our engineering team has released a fix for editing html in the rich text editor, let me know if this has resolved the issues you were running into!
@maddy It appears that this issue isn’t completely fixed.
It looks like the editor now strips all classes/styling if content was updated from the WYSIWYG Editor after styling has been applied from source.