Issue #1694Opened December 30, 2018by froderf0 reactions

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)

artfJanuary 4, 20190 reactions

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{...}')

mailtopaul8January 8, 20190 reactions

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?

artfJanuary 14, 20190 reactions

@mailtopaul8 I'll try to bring it in the next release

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.