[QUESTION] Have to have all the blocks the same styles by definition
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)
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
@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!
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 before the template is loaded and any new class will be passed by the listener
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1877
[FEATURE REQUEST] Custom styles that add/remove custom classes?
Currently, all the style manager values that you change for an element simply update a <style> tag inline in the HTML. Is it possible to ch...
Issue #1822
[QUESTION] - Add style sector for specific Css rule
Hey @artf , COuld you give your help on this one? I want to disable the user to able to select the wrapper block (body) but I still want to...
Issue #1864
[QUESTION] Best way to listen to changes on the final HTML?
Hi, I just had a quick question because I could not figure out how to do it or did not find an issue related to it. I am just trying to cal...
Issue #1514
How to add video block on blockManager
Hello All. i want to add a video block on blockmanager same as mentioned on below snapshot i am using following code for adding video block...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.