Issue #1179Opened June 6, 2018by mfloressosa1 reactions

[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)

artfJune 8, 20181 reactions

I've already made a fix for this, it will be available in the next release

mfloressosaJune 8, 20180 reactions

Great! I'll be waiting for this release to come out.

Thanks!

lock[bot]September 17, 20190 reactions

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.

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.