Issue #2103💬 AnsweredOpened June 27, 2019by imanubhardwaj1 reactions

Custom Component dragging issue

Quick answerby artf1

With this you're still letting the view capturing your click events, so fix it:

Read full answer below ↓

Question

This is how I've created a custom component: This is my custom block: The thing is that I have wrapped the image tag inside <a> tag when it is rendered to canvas. When I click on the element and try to drag it, only <img> tag gets dragged and <a> remains on it's original place. Live demo

Answers (3)

artfJuly 31, 2019

With this

view: {
    dragstart: 'noDrag'
  }

you're still letting the view capturing your click events, so fix it:

view: {
    events: {
      dragstart: 'noDrag'
    }
  }
artfJuly 4, 2019

Well, I see 2 different solutions for this case:Easy and fast, make the custom-video component not draggable, so you have to drag the parent to move it. The tiny downside is more from UX side, you force users to select the parent.More solid solution. Make the <a> element a custom component itself,...

imanubhardwajJuly 4, 2019

Thanks @artf but a new problem is arising now, when I drag the custom-video-wrapper component across the canvas, custom-video isn't dragged with it, only the <a> tag is dragged.

Live Demo

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.