Issue #1893πŸ’¬ AnsweredOpened March 14, 2019by trivago-vgarcia1 reactions

Have to have all the blocks the same styles by definition

Quick answerby artf❀ 1

First of all, your example/problem has nothing to do with the custom render in blocks (you'd use it to customize the UI of blocks not components in the canvas). A solution is to set that class private

Read full answer below ↓

Question

We are using blockManager, as you can see in the example posted to codesandbox, following the documentation related to custom render. The unexpected behavior for us is that each time a user edits the styles of a block, all blocks are updated with that style, because the style has been set to the class used in the block, in this case .row-cell.

  • Is this the expected behavior?
  • How can we avoid it?

Thanks!

References: https://codesandbox.io/s/wkr3oqxpw8 https://grapesjs.com/docs/modules/Blocks.html#custom-render

Answers (3)

artfβ€’ March 22, 2019

First of all, your example/problem has nothing to do with the custom render in blocks (you'd use it to customize the UI of blocks not components in the canvas).

A solution is to set that class private

trivago-vgarciaβ€’ March 27, 2019

@artf Thanks for the reply! Sorry, because the example wasn't clear. It happens on every case, I mean, even when they are defined in the default template, and not only when a new selector is added. So, using selector:add wont fix all the cases.

Do you have any other suggestion? Thanks!

artfβ€’ March 29, 2019

It happens on every case, I mean, even when they are defined in the default template, and not only when a new selector is added. So, using selector:add wont fix all the cases. selector:add is triggered even when a new class is added from parsing. So, place it as a plugin, so it will be attached bef...

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.