Can't reset body background
Question
I've found this
editor.CssComposer.getAll().reset();
here #351 but seems not to reset the body background...
Any other way to do this?
Answers (3)
@duskhacker I'd say it's somehow related but not the same issue.
CSS you're mentioning it's generated from two different places and it's some kind of a basic CSS reset
*{box-sizing: border-box;} comes from https://github.com/artf/grapesjs/blob/dev/src/editor/config/config.js#L34
and body{margin:0;} from https://github.com/artf/grapesjs/blob/dev/src/dom_components/config/config.js#L10
Probably what I'll gonna do for the next release is to move the current wrapper style inside protectedCss option.
For those who are trying to achieve edit the CSS directly with the code editor should add a new view code command (current) and replace em.getCss() with em.getCss({ avoidProtected: 1 }) (not yet implemented)
Hi @g41n,
Can you provide a jsfiddle (or equivalent) showing the issue? I just put this together which first sets the body background color to blue, and then clears that style 2 seconds later: https://jsfiddle.net/gn3jtahv/. That seems to work just fine for me (also tested using editor.CssComposer.getAll().reset() with the same result), so I'm guessing that you're doing something differently...
Hi @ryandeba, thanks for the reply.
After some digging here there is a fiddle https://jsfiddle.net/x118ks1v/ and steps to reproduce:
- click on the reset button, reset is successfull
- click on body and change background from the panel on the right
- click on the reset button, reset failed
The problem seems occour only after you change body background from grapesjs panel manually.
Hope it helps to find a solution... :/
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1579
Border Color Issue
@artf There is bug in the border color if you drag a button on the editor and paste color like rgb(255, 0, 0) in border color and select an...
Issue #2044
Npm start to develop on local server didn't work
Did the procedure to start the local server using dev branch as described on README, it worked on the console, but fails on chrome and the...
Issue #1506
Css Media Query Issue
Hello @artf There is an issue on demo page as well as library in media query. Issue is that if user update style on mobile view first and t...
Issue #896
[BUG] Media query rules are overridden by class rules in canvas
Hi @artf , I've noticed an issue while testing one of my templates using different device configurations that supposed to trigger media que...
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.