2

I am experimenting with grapes js page builder with the webpage plugin.

The issue is that I was not able to find a way to completely disable the style editor they have (I managed to not auto-select the style manager when you click an element) but I want to completely remove the option for the user to edit existing styles.

Basically the user must only be able to drag existing blocks and edit the text inside them and not style them in any way.

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Stem Florin
  • 896
  • 1
  • 7
  • 18

2 Answers2

1

You can also acheive this by changing the "appendTo" property of the Style Manager config to a new div that's not in the DOM

const editor = grapesjs.init({
 styleManager: {
   appendTo: document.createElement('div'),
 },
 ...
})

This way, the style manager simply won't be rendered.

GiorgiosJames
  • 742
  • 7
  • 11
0

The way I solved the issue was by copy & pasting the node_modules/grapesjs-preset-webpage/src/panels/index.js and simply commenting out the code that was defining the panel I wanted to get rid of.

I also had the copy and paste the node_modules/grapesjs-preset-webpage/src/index.js and editing it to import my panels.js file.

Not the best way of doing this for sure but for now that will do.

PS. I also thought of simply hiding the panel using CSS but that seemed more of a hack than this.

Stem Florin
  • 896
  • 1
  • 7
  • 18