grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

Remove Duplicate Css Rule by Class

Open froderf opened this issue 8 years ago • 2 comments

Hi @artf , I'm reading and experimenting the setStyle method but when i used setStyle editor.getSelectedToStyle().setStyle({ color: 'red' })

it duplicates the css rule of that class e.g

.class1{
 color: 'black';
}

.class1{
 color: 'red';
}

What I want is either removed the existing class

.class1{
 color: 'black';
}

or update that existing class css rule

.class1{
 color: 'black';
}

This issue is very similar to issue 932. I need avoidInlineStyle: to be set to false since im using inline style.

Please help. Thanks

froderf avatar Oct 30 '18 09:10 froderf

If there's no work around for this issue. what I need right now is used cssComposer.getClassRule()

but the problem is, it is selecting the first class

.class1{
 color: 'black';
}

and not this updated class

.class1{
 color: 'red';
}

froderf avatar Oct 30 '18 09:10 froderf

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 Oct 30 '19 09:10 lock[bot]