Issue #2368Opened November 2, 2019by trafalmejo0 reactions

[QUESTION] All instances of custom component are being updated

Question

Hi,

I created a custom component for a toggle button. My problem is that once I drag and drop more than one, and then I edit any of them, all instances are being updated in terms of color, size, etc. I am using the latest version of grapesjs

editor.BlockManager.add('toggle', {
  label: 'Toggle',
  attributes: { class:'fa fa-toggle-on'},
  category: 'Basic',
  content: '<label class="switch"> <input type="checkbox"><span class="slider"></span></label>'
})

All the animations and properties are in the CSS that I loaded in the editor. Any idea why this can be happening?

Answers (2)

pouyamiralayiNovember 2, 20190 reactions

Hi! i guess this is because your blocks posses similar classes and have selectors in common. in the latest version, avoidInlineStyle is true by default, so are you experiencing this on the latest version?

artfNovember 2, 20190 reactions

The guess by @pouyamiralayi is right, this happens because of the same classes and you have to toggle them in the style manager to make stylable only the component style. BTW I'll try, soon I hope, to provide a more intuitive solution

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.