GrapesJS / style-bg

Full-stack background style property type for GrapesJS, with the possibility to add images, colors, and gradients
MIT License
33 stars 18 forks source link

There is no display plugin... #9

Closed justin3737 closed 1 year ago

justin3737 commented 3 years ago

hi @artf thank you for doing everythings here but I try to use this plugin but I can't img demo https://jsfiddle.net/e4pbsgm0/

mmotov commented 3 years ago

@justin3737 did you managed to solve this? I have the same issue

ronaldohoch commented 3 years ago

Same here!

ronaldohoch commented 3 years ago

I don't know why, but in the index.html from repo's root folder, it has this code:

      editor.StyleManager.addProperty('extra', [{
        name: 'Background',
        property: 'background',
        type: 'bg',
      }]);

Also, in the https://grapesjs.com/demo.html we have these config, inside

'gjs-preset-webpage': {
   ... some configs
   customStyleManager: [{
      ...A lot of other configs
      {
         name: 'Decorations'
         properties: [{...},{...},
            {
               id: 'background-bg',
               property: 'background',
               type: 'bg',
            }
        ]
    }]
}

image So... I think we have to configure like it.

But, doing this... We get 2 background configurations in style panel, i'm looking to remove the other background from styles. If i got some updates, i'll put it here.

ronaldohoch commented 3 years ago

So, @artf can say if i'm wrong, but, we can do it:

editor.StyleManager.removeProperty("decorations","background-bg")
editor.StyleManager.addProperty('extra', [{
  name: 'Background',
  property: 'background',
  type: 'bg',
}]);
mmotov commented 3 years ago

@ronaldohoch thanks for sharing, that helped!

bernhardmiller commented 3 years ago

I also had this problem, and managed to make it work with a configuration like this:

styleManager: {
        // ...
        sectors: [{
            // ...
            buildProps: [
                "background-bg", // ...
            ],
            properties: [
                // ...
                {id: 'background-bg', name: 'Background', property: 'background', type: 'bg' },
            ],
        }],
    },
artf commented 1 year ago

The new version should be easier to use as it extends the built-in background property.