How to add !important in all the generated apis
Question
Hello @artf,
While i am going to edit some html from editor with the help of css then i need to add !important into all the css which is changed.
Let me give you an example, This is previous css
.banner-title {
background-color: #e6d8d8;
border: 3px #acbe5a #b83dd3;
color: #f80000;
}
Now i am going to change this font's color with #000.
then only this changed css need to be append with !important, So, new css will be get while i am going to fetch using editor.getCss() will be like,
.banner-title {
background-color: #e6d8d8;
border: 3px #acbe5a #b83dd3;
color: #f000 !important;
}
Can i achieve this goal?
Answers (3)
I may have found a solution for your problem. Please check https://github.com/artf/grapesjs/issues/1041#issuecomment-382545102
I don't think you need to add !important because your element with the class .banner-title gets a unique class added holding the property that has changed.
So if you change the color, a new class is added with color: #your-color and thus the color defined in .banner-title is overwritten.
@NicoEngler , Thank you for your valuable response. But thing is that i am loading one default template page with default css. In this css we have css like
.banner-title {
background-color: #e6d8d8;
border: 3px #acbe5a #b83dd3;
color: #f80000 !important;
}
Now when i am changing the color to #000 using editor then the new css will be created like,
.banner-title {
color: #000;
}
But thing is that default css have already !important so it will take the default template's css not the new one.
So, that's why i'm adding !important to new generated css by editor.
Let me know if you didn't got my point i can understand with more description.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #509
Span are not editable as text
Hello Artf, I have a problem when importing some html templates. I was initially not able to see span texts. But after helping the editor r...
Issue #1660
Content will automatically removed while edit in editor
Hello @artf I am facing an issue with grapes.js while editing any textual content. I am using grapes.js Version 0.14.37 with angular 1.6.1....
Issue #1525
How to get data from forms in grapesjs
Hello All, I am using Forms block in grapejs and using grapesjs with angular 6. but i am not getting that how can i get data from forms whi...
Issue #1061
How we can show countdown traits
Hi artf, Please let us know how we get the countdown elements in edit mode means when we set the template html using editor.setComponents(t...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.