GrapesJS / preset-webpage

GrapesJS Plugin Webpage Preset
http://grapesjs.com/demo.html
BSD 3-Clause "New" or "Revised" License
335 stars 291 forks source link

Classes on the body get removed by grapesjs #82

Closed adiux closed 1 year ago

adiux commented 1 year ago

As a user, I can add classes to the body in the UI. When the code is saved and the editor is reopened with that code, the classes are ignored and removed.

Or in general: when loading HTML that contains a CSS class on the body element, it is ignored and removed by Grapesjs. E.g.

<div id="gjs">
    <body class="bg-dark"><h4 class="text-white">About</h4></body>
</div>
grapesjs.init({
  container: '#gjs',
  fromElement: 1,
  height: '100%',
  plugins: [grapesjswebpage],
  pluginsOpts: {
    [grapesjswebpage]: {},
  },
});

Resulting editor

image
artf commented 1 year ago

When the code is saved and the editor is reopened with that code, the classes are ignored and removed.

I see it working properly on the demo of this plugin. Are you sure you're using the latest versions of grapesjs and the plugin?