Issue #1550💬 AnsweredOpened October 30, 2018by froderf0 reactions

Remove Duplicate Css Rule by Class

快速解答by 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 and not this updated class

Read full answer below ↓

Question

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

Answers (2)

froderfOctober 30, 2018

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';
}
lock[bot]October 30, 2019

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.

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...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.