[Question] Cannot load styles saved as !important
Question
Hi!
I'm trying to make all the user-set styles have the "!important" flag, in order to prevent some other previous existent classes to override it (eg bootstraps's text-muted). I think I almost have it working well. However, I'm having a problem while trying to re-open a previously exported design.
I used this #1056 to make all new styles be added with !important in every property. This works fine, and it is indeed added in both, the canvas and the exported CSS.
The problem comes when I try to re-open the exported design. As every property now have the !important text after the actual style value, many inputs types in the style manager are not recognizing the original value. For example all the combo and radio type styles are shown empty. The color pickers show something like "rgb(254, 13, 13) !important" and won't show the correct selected color. The styles in the canvas are actually being applied.
Maybe there's a way to customize a "style load function", or make the style manager ignore the "!important" declaration while loading a style. I've researched but couldn't find it.
My second aproach was to remove all the "!important" text before loading the CSS, and then after the editor loads, try to loop over and re-set the styles, in order to make the "styleable:change" event adjust them, in the same way as when the property is manually changed. This didn't worked, because every API-way I tested to set the style o trigger events, acted in the same way as having the "!important" in the first place (leaving empty combos, etc). I couldn't find an API way to actually "select the element and make a manual click into the combo".
Any recomendations on how to solve it?
Please sorry my english and thanks in advance!
Answers (3)
I've already made a fix for this, it will be available in the next release
Great! I'll be waiting for this release to come out.
Thanks!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #490
Prevent modifying specific image components
I have a use case where I would like to make some specific components completely locked down (i.e. not resizable, not draggable, not copyab...
Issue #1875
[QUESTION] ID changes when importing html or passing html in components prop in config.
Hi, I built a component and block that I can drag and drop in the canvas. My issue is that some styles rely on the ID. I know this might no...
Issue #1892
[Question] Flexbox column is not working correctly.
Hi @artf , We are using flexbox block. The problem is, when we are trying to resize the middle column it affects all other columns, like au...
Issue #1475
[Question] adding filter to styleManager
Hi, I am trying to add a filter property to Styles. The problem that I am having is that the property demands 2 arguments: 1. The type of f...
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.