Can't reset CSS code which has parent or child.
To remove the CSS codes that belong to a specific block. Indeed that block of CSS doesn't belong to any component (I'm talking about how the editor works) so that declaration is always rendered. GrapesJS can associate only class-based selectors, eg. not even nested like .class1 .class2, in that case the rule is import...
Read full answer below βQuestion
Tested on both npm and cdn GJS Version - 0.14.20 (latest) OS - Mac Browser - Chrome Problem If CSS class name has a parent or child like #parent .child{ color: red }, user can't reset the style to origin, it still remain inside CodeViewer. Codepen Demo 1 - Adding CSS from block Codepen Demo 2 - Adding CSS inside #gjs <div> In demo1, Let's say user drag "Test Block" into the canvas and remove it. CSS style will still remains inside the CodeViewer. Even user clear the canvas, it will not be removed. I am not sure this is a bug or not. But in most case, we used to declare CSS selectors including...
Answers (3)
To remove the CSS codes that belong to a specific block. Indeed that block of CSS doesn't belong to any component (I'm talking about how the editor works) so that declaration is always rendered. GrapesJS can associate only class-based selectors, eg. not even nested like .class1 .class2, in that cas...
This is because you're just clearing components. You can use the built-in command core:canvas-clear
@artf Thanks for your quick reply. Sorry for my unclear question. What I actually want to achieve isTo remove the CSS codes that belong to a specific block. For example, when I delete a block in the canvas, the CSS codes of that block will also be deleted. I don't want to clear the entire canvas. P...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1505
Adding row and sections not working
i am integrating grapejs with angular6. but it is not working means it is not showing on blocks i am using following code
Issue #519
No Blocks by default
Using this code I get an editor but there are no blocks. I also do not get the icons for the screen size but other icons are there. As you...
Issue #615
Apply style to child classes
How we can add style to child classes of editorform? var forminputClass = cssComposer.add([editorform, forminput]); Above code will apply c...
Issue #859
Change canvas style
Hi there, I have some question about canvas style, in this case i have config like this. By default i use css with name builder-desktop.css...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins β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.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.