kaoz70 / grapesjs-blocks-bootstrap4

GrapesJS Bootstrap v4 Blocks Plugin
BSD 3-Clause "New" or "Revised" License
153 stars 106 forks source link

How to add single block from panel ? #47

Closed miknaz closed 3 years ago

miknaz commented 3 years ago

Great plugin! But can I add only Card block to grapesjs panel ?

Thanks!

kaoz70 commented 3 years ago

If I understand correctly, you only want the card block to appear in the panel, and remove the rest? If that's the case, then you should be able to do that with the configuration object of this plugin that you pass on to GrapesJS

miknaz commented 3 years ago

Can you tell me, please, what should I set to the configuration object of this plugin to get only Card block on my panel ?

kaoz70 commented 3 years ago

You should check the docs on how this is done, but this is how I would do it:

var editor = grapesjs.init({
    ....
    pluginsOpts: {
      'grapesjs-blocks-bootstrap4': {
        blocks: {
          alert: false, // Set all of the blocks that you want to remove to false individually
        },
        // Remove complete categories here
        blockCategories: {
          typography: false,
          forms: false,
          layout: false,
        },
        ....
      },
    },
  });