CSS composer not working on two classes
Question
//returnedCssObject is an object that contains css styles
cssComposer.setClassRule("class1 class2", returnedCssObject);
above code is not working but the below is working
//returnedCssObject is an object that contains css styles
cssComposer.setClassRule("class1", returnedCssObject);
All i need is to apply the css rule in two class .class1 .class2{ ... color: red; ... }
Answers (3)
This is not how setClassRule is supposed to work. The first argument is only for 1 class name.
Currently, there is no specific API method for your case, probably the best one, for now, is editor.CssComposer.getAll().add('.class1 .class2{...}')
I need to have a new CSS rule with the combination of both ID & class but currently there is no way to do that (tried using setIdRule by adding .class after ID but didn't worked). Can you add a method like setRule which would simply accepts a whole selector with ID & class combination?
@mailtopaul8 I'll try to bring it in the next release
Related Questions and Answers
Continue research with similar issue discussions.
Issue #615
Apply style to child classes
How we can add style to child classes of editorform? var forminputClass = cssComposer.add([editorform, forminput]); Above code will apply c...
Issue #1978
[Bug]: Styles allways applied to classes
Hello, I have a Problem with styling individual Items. The following html Code: Loads fine. But when I Click the Component with "#icbp" the...
Issue #843
[QUESTION] - CssComposer - removes unused classes
hi @artf , I import a html , using import from grapesjs-preset-newsletter, with some css classes inside the <style> tag. After the import,...
Issue #1877
[FEATURE REQUEST] Custom styles that add/remove custom classes?
Currently, all the style manager values that you change for an element simply update a <style> tag inline in the HTML. Is it possible to ch...
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.