Issue #2393✓ SolvedOpened November 8, 2019by troncoso2 reactions

Determine why 'block:drag' event won't fire

快速解答by troncoso2

Thank you for that information. However, in my case this was not working due to this in the index.html: Removing these attributes resolved my issue.

Read full answer below ↓

Question

My company uses GWT (Google Web Toolkit) to develop some web applications. We have a stand alone GWT component library for our re-usable components. I created a component that wraps grapesjs and it works great.

However, when I import this library into an actual project and add the grapes editor to a screen, everything works fine except dragging blocks onto the canvas. After diving into the grapesjs code, I found that BlockView::handleDrag() is not being called. BlockView::handleDragStart() does get called however. BlockView::handleDragEnd() also does not get called.

Is there some way I can possibly check what would stop the drag event from firing? This is the only code in the handleDrag() function:

  handleDrag(ev) {
    this.em.trigger('block:drag', this.model, ev);
  },

So it seems that Backbone is not publishing the actual browser drag event.

Thanks!

Answers (3)

👍 Most helpfultroncosoNovember 12, 2019

Thank you for that information. However, in my case this was not working due to this in the index.html:

<body ondragstart="return false;" ondrop="return false;">
</body>

Removing these attributes resolved my issue.

pouyamiralayiNovember 10, 2019

@Troncoso can you provide a fiddle to reproduce this?

troncosoNovember 11, 2019

Well, no, not likely. Not only is GWT a Java framework, but I have grapesjs working in one GWT project but not another. I imagine this will likely get closed, but I was hoping that posting it as a question might net me some suggestions. This is something I'll have to figure out, but I was looking for some help on how I can troubleshoot grapes events.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.