GrapesJS / mjml

Newsletter Builder with MJML components in GrapesJS
http://grapesjs.com/demo-mjml.html
BSD 3-Clause "New" or "Revised" License
618 stars 218 forks source link

Selector Manager (Classes) disappeared in Style Manager #345

Closed LordRembo closed 5 months ago

LordRembo commented 5 months ago

I'm trying to update an implementation of GrapesJS with MJML and found that when going from grapes-mjml 0.6.0 to the next version (1.0.x) and higher, the Style Manager no longer shows the Classes. the grapes version doesn't make a difference. I'm on 0.18.4 but it happens on the higher versions as well.

You can also see this in the online GrapesJS demo:

The main difference between both, is the loading of the grapes-mjml plugin. In my local project, removing it made the Classes Sector appear again but then I can't use my templates of course. So it's definitely related to a change in the grapesjs-mjml module. Looking at the changelog, I can't figure out what is the big difference that now makes this fail.

Maybe someone here has an idea?

LordRembo commented 5 months ago

So, I figured some config keys and defaults must have changed and indeed, hideSelector seems to have been added to the options. But simply setting it to false in the plugin options, doesn't fix things. This is my config:

this.editor = grapesjs.init({
      selectorManager: {
        componentFirst: true,
      },
      clearOnRender: true,
      container: '.builder-panel',
      components,
      height: '100%',
      storageManager: false,
      assetManager: this.getAssetManagerConf(),
      plugins: [grapesjsmjml, grapesjspostcss, grapesjsmautic, 'gjs-plugin-ckeditor'],
      pluginsOpts: {
        [grapesjsmjml]: {
          hideSelector: false, // this one seems to be set to true by default
          custom: false, // this one seems to be set to true by default
        },
        grapesjsmautic: BuilderService.getMauticConf('email-mjml'),
        'gjs-plugin-ckeditor': BuilderService.getCkeConf(),
      },
    });
LordRembo commented 5 months ago

Finally figured it out. Need to make sure the correct plugins are loaded. I didn't have need for grapesjsnewsletter. So just adding selectorManager and the 2 pluginOpts seems to fix things. And make sure to put grapesjsmjml in square brackets.