grapesjs

Override default component settings in grapesjs?


I am using GrapesJS in a CMS. By default, added blocks come with component settings defined in this file:

https://github.com/artf/grapesjs/blob/dev/src/dom_components/model/Component.js

How do I override the default component settings so they can be applied globally to all components within my custom blocks?


Solution

  • This is how I do it:

    grapesEditor.BlockManager.get('image').set({
        content: { style: 'color: "black"; max-width: 962px;' },
    });
    

    Where grapesEditor is the instance of the editor that you get when initalizing it.