GrapesJS / mjml

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

After drap and drop <mj-image /> #188

Closed ramkychowdary closed 1 year ago

ramkychowdary commented 4 years ago

I am facing one of issue after drap and drop of I want to insert padding-left="0px" padding-right="0px" padding-bottom="0px" padding-top="0px" by default as show in below. Can you please help me here.

<mj-image src="https://sample.com/inc/images/welcome_logo.png" padding-left="0px" padding-right="0px" padding-bottom="0px" padding-top="0px" width="100px" align="justify"/>

DRoet commented 4 years ago

Only way I can think of is using the BlockManager to re-add the block with your own preference:

const image = editor.BlockManager.get('mj-image')
const image.content = '<mj-image src="test.png" padding-left="0px" etc..></mj-image>'
editor.BlockManager.remove('mj-image')
editor.BlockManager.add('mj-image', image)