[BUG] Grapesjs doesn't initialize styles for wrapper
Question
Hello, I've met a bug where grapesjs doesn't initialize styles for wrapper. Steps to reproduce:
- Go to https://grapesjs.com/demo.html
- Select wrapper and set background. It will add "body" rule to styles and it will be displayed in style settings
- Refresh the page - "body" rule still present (you can check it in "View Code" modal) but it didn't applied to the wrapper

Also it is causes in my project similar problem to this - https://github.com/artf/grapesjs/issues/2231
Answers (3)
This seems to fix the issue:
const wrapper = editor.getWrapper();
wrapper.set('attributes', { id: 'grapes-iframe-body' });
Any reason not to do this @artf ?
Hey, this issue is still persisting. The Classes and CSS added to the body layer (wrapper) get wiped every time it's restarted. It seems to be that the ID get's randomised and that's why the CSS breaks, but unsure why the class gets cleared.
I am facing the same issue. Is there any workaround for this issue suggested by grapesjs team? Meanwhile, is there any timeline for fixing this issue?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1396
[Bug] Background image layers
Bug: when your pre-defined block or saved templates have two or more background layers, if you add a new layer, a lot of new empty layers a...
Issue #5583
BUG: Can't set background:none in mobile version using styles panel
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Edge last version Reproducible demo link h...
Issue #4257
BUG: Background modification doesn't work for non-images
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v100 Reproducible demo link https:/...
Issue #3866
BUG: SVG Not rendering when inside any HTML Element
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? Version 94.0.4606.81 (Official Build) (64-bi...
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.