Issue #2936Opened August 3, 2020by lavioros5 reactions

QUESTION: Inline style loads on id instead of class

Question

Hello,

I have been using your tool for a while and I decided to upgrade to a newer version(from v0.12.37 to v0.16.3 + gjs-preset-newsletter). I have the styles stored inline, I know it is not desirable, but since we use the tool for authoring emails, it is still a safer option.

Is there a way to load inline styles on the class, if the component has a class already set(as it used to be in older versions)?

I have a JSfiddle example here: https://jsfiddle.net/Lo91v0um/1/

Hence, in my case, I have the following component:

<div style="font-size: 20px;" class="my-class" >A text component</div>

If I select the component, the selector is shown to be class "my-class", but the style is added to the id. When editing the component's font-size it would be added to the class and the changes would not be visible because they are overwritten by those already set on id.

I tried adding avoidInlineStyle, but this added one extra class for each component at every editor load, and that was not the desired behavior.

Is there any way I can still achieve the old behavior? (prior to 0.14.40)

Thank you very much! Lavinia

Answers (1)

artfAugust 26, 20205 reactions

I'd suggest using this option

grapesjs.init({
  ...
  selectorManager: {
   componentFirst: true,
  },
})

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.