grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

CSS composer not working on two classes

Open froderf opened this issue 7 years ago • 5 comments

//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; ... }

froderf avatar Dec 30 '18 09:12 froderf

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

artf avatar Jan 04 '19 14:01 artf

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 avatar Jan 08 '19 13:01 mailtopaul8

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

artf avatar Jan 14 '19 12:01 artf

Okay thank you very much :)

mailtopaul8 avatar Jan 19 '19 14:01 mailtopaul8

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.

lock[bot] avatar Jan 19 '20 16:01 lock[bot]