Issue #4900Opened February 5, 2023by handhikadj0 reactions

BUG: setStyle/getCss() produces duplicated css

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

Chrome Latest

Reproducible demo link

https://codesandbox.io/s/silent-river-ifczcv

Describe the bug

How to reproduce the bug?

  1. Visit the site
  2. See console. Pay attention to the * and body selector

Expected result Should not be duplicated

If is necessary to execute some code in order to reproduce the bug, paste it here below:

editor = grapesjs.init({ 
    storageManager: false
    // ...
    })

editor.on("update", () => {
        // save to backend
        console.log("editor getCSs", editor.getCss());
      });

      editor.on("load", () => {
        // this will come from backend
        const style = "* { box-sizing: border-box; } body {margin: 0;}";
        
        editor.setStyle(style);
        
        // const html = backendHtml (<body><div></div></body>)
        // editor.setComponents(html)
      });

Description

I do this because the new storageManager mechanism/schema destroys my entire app, especially the backend stuff.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (1)

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.