Issue #710✓ SolvedOpened January 4, 2018by austinbiggs3 reactions

Make an entire element draggable, not just the handle

Quick answerby artf3

Try with something like this

Read full answer below ↓

Question

I'm working on modifying the handle from draggable elements, in addition to having a handle, I'd like the entire element to be draggable. Looking through the code, I would assume I would just need to attach the tlb-move command to a draggable element on select. The above code, on select, writes the selected component to the console. From here I believe I would need to add an event listener for dragging, however, my attempts to attach a listener using .on() have failed. Any advice on how to attach an event listener to a select component?

Answers (3)

👍 Most helpfulartfJanuary 4, 2018

Try with something like this

JogaiMarch 20, 2018

I followed your suggestion, but I get an error: "Uncaught TypeError: Cannot read property 'type' of undefined" editor.on('component:selected', () => { const selected = editor.getSelected(); if (!selected || !selected.get('draggable')) return; const el = selected.view.el; if (!el.hasCustomEvent) { e...

JogaiApril 17, 2018

Thanks so much for the update! I'm still a bit struggling to implement it right. I made an example: https://codepen.io/anon/pen/vRoRBX The example is preventing the user from doing too much. Most of the elements are made non-draggable. The user should be able to reorder. I've got several problems w...

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 →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.