GrapesJS / mjml

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

How do I make views-container resizable without breaking styles manager #232

Closed mercymantis closed 1 year ago

mercymantis commented 3 years ago

Hi,

I'm new to GitHub and am not sure if this is right place to ask for some help with this plugin. Anyhow, I'm tring to make the views-container resizable and am having trouble with it. Here's my code.

editor.on('load', function () { var resizable = { maxDim: 400, minDim: 200, tc: 0, cr: 0, cl: 1, bc: 0, keyWidth: 'width' };

var p = editor.Panels.getPanel( 'views-container' );
p.set( 'resizable', resizable );

editor.Panels.render();

});

Setting the resizable property alone doesn't work, I had to call Panels.render() in order to get the properties to take effect. After doing this, the scroll bar appears and I can resize. However, by calling render, the StylesManager becomes broken ( displays as blank ).

I also tried backing up, removing and adding the panel back.

var p = editor.Panels.getPanel( 'views-container' ); p.set( 'resizable', resizable ); editor.Panels.removePanel( 'views-container' ); editor.Panels.addPanel( p );

This has the same effect where the container is resizable but the StyleManager is broken. Can someone please help me out.