Issue #4719Opened November 9, 2022by ronaldohoch0 reactions

BUG: Strange behavior when trying to change color of buttons and texts

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Brave last version

Reproducible demo link

https://jsfiddle.net/qsd9zjrc/

Describe the bug

How to reproduce the bug?

  1. Open the link (https://jsfiddle.net/qsd9zjrc/)
  2. Try to change text color
  3. Try to change green button color by click in it and go to Typography
  4. image
  5. You will notice that color has a !important in it.
  6. image
  7. Also, when you try to change the color, it always keep going back to the previews color with !important on it.

What is the expected behavior? Make the StyleManager not use the !important on elements or have a flag for the StyleManager not to use it.

What is the current behavior? GrapesJs is putting !important in css rules

If is necessary to execute some code in order to reproduce the bug, paste it here below: This code is in jsfiddle, the html and styles were generated by our tool created to convert templates with old patterns to be interpreted by GrapesJs.

editor.setComponents(`  <div din_editor_version="2.0.0" class="body">
    <div draggable="true" data-highlightable="1" class="gjs-row" id="ig50u">
      <div draggable="true" data-highlightable="1" class="gjs-cell not-flex-grow" id="iieji">
        <div id="ic9nr">
          <p id="isd7g">
            <a background-color="#00B050" margin-horizontal="20" margin-vertical="20" padding-horizontal-botao="20" padding-vertical-botao="20" border-radius="0" class="text" id="idr7f"><b>
              Baixe agora
              </b></a>
          </p>
        </div>
      </div>
    </div>
    <div draggable="true" data-highlightable="1" class="gjs-row" id="i1sf4">
    </div>  
  </div><style>.text{
  color:#d31f1f !important;
}
#ig50u{
  background-color:rgb(0, 153, 120);
  background-size:cover;
  background-position:center top;
}
#iieji{
  margin:0 auto;
  width:900px;
}
#ic9nr{
  padding:5px 15px;
}
#isd7g{
  padding:0px;
  text-align:center;
  margin:0 auto;
}
#idr7f{
  display:inline-block;
  border-style:solid;
  border-width:0px;
  border-radius:0px;
  font-size:18px;
  padding:20px;
  margin:20px;
  text-align:center;
  background-color:rgb(0, 176, 80);
  border-color:transparent;
  text-decoration:none !important;
  color:rgb(255, 255, 255) !important;
}
#ix52f{
  font-size:20px;
}
#i1sf4{
  background-color:rgb(209, 209, 209);
}
</style>`)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (0)

No answers yet.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.