Using Style tag instead of css
Hi @Owchzzz, It seems to be baked into the core of GrapesJS that components will not have a style tag - see this example where it is explicitly removed. I'm not sure if modifying this behavior would completely solve your use case, but you could start by overriding it with the following code: You probably want this cod...
Read full answer below âQuestion
Hi,
I've been taking a look inside of the dom_components, but cant seem to figure out how to manually override the styling aspect.
I need a way for the component to be able to save all new styles into the style tag instead of the actual css class. (Try moving a component that was styled with force css) and it removes all of the style.
Hope you can help, Best Regards, Richard
Answers (3)
Hi @Owchzzz, It seems to be baked into the core of GrapesJS that components will not have a style tag - see this example where it is explicitly removed. I'm not sure if modifying this behavior would completely solve your use case, but you could start by overriding it with the following code: You pr...
So did you mange to find any complete solution that leaves the style tags intact with no changes?
The solution by @ryandeba seems to influence only the use of inline style attributes like <div style="...">. (but for me those were also not filtered out without overwriting that prototype. We are having the problem that is filtered out, not sure if the OP has the same problem
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3401
Can style manager always generate IDs instead of using already defined element's class ?
When we style an element in the editor, if this element doesn't have neither a class or an id, the style manager generate a new id with the...
Issue #3222
How to refresh/re-render after new node added?
I manually add a new node into a rendered component. The visual result is OK, but impossible to save, because my style isn't with the auto-...
Issue #1888
[Question] Add custom html inside canvas
Hi there, I'm using grapes to export a custom json with all the information i need, instead of HTML and CSS. For doing that I'm parsing the...
Issue #3116
[HELP WANTED] How to load css that can viewed in code viewer and also exported while saving
Hi :wave: I am trying to load some CSS within the editor as part of the theme, I am able to link stylesheets as part of loading but the pro...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins âPremium plugins ship with support, regular updates, and production-ready features â save days of integration work.
Browse premium plugins âBrowse Plugin Categories
Jump directly to plugin category pages on the marketplace.