GrapesJS / mjml

Newsletter Builder with MJML components in GrapesJS

Home Page:http://grapesjs.com/demo-mjml.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Component not draggable - grapesjs@0.21.2, grapesjs-mjml@1.0.2

oreshkin-ay opened this issue · comments

Hey! I'm trying to run some simple code with the latest versions - grapesjs-mjml plugin , but I'm getting an error on DnD. Found similar questions, but all the solutions do not work, could you help?

image
<link href="https://cdn.jsdelivr.net/npm/grapesjs@0.21.2/dist/css/grapes.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/combine/npm/grapesjs@0.21.2,npm/grapesjs-mjml@1.0.2/dist/index.js"></script>
<style>
  body,
  html {
    height: 100%;
    margin: 0;
  }
</style>

<div id="gjs">
  <mjml>
    <mj-body>
      <mj-section>
        <mj-column>
          <mj-text>My Company</mj-text>
        </mj-column>
      </mj-section>
    </mj-body>
  </mjml>
</div>

<script type="text/javascript">
    const editor = grapesjs.init({
      height: '100%',

      container : '#gjs',
      fromElement: true,


      canvas: {
        frameContent: '', // default is '<!DOCTYPE html>'
      },
      plugins: [
        'grapesjs-mjml'
      ],
      pluginsOpts: {
        'grapesjs-mjml': {
          resetDevices: false // so we can use the device buttons
        }
      }
    });
</script>

In MJML, components can't be dropped everywhere you want, each one has a specific component/s where it could be placed. By checking your snippet it seems to behave properly so I guess you're simply trying to drop a component in an invalid place.

https://jsfiddle.net/5qm842x3/