Issue #3939💬 AnsweredOpened November 13, 2021by xQwexx0 reactions

Disabled drag and drop in preview

Quick answerby artf

Hi @xQwexx what would be your solution in such a case? We still need to keep the D&D disabled in the preview. Can you also post your component code in order to understand better the use case?

Read full answer below ↓

Question

GrapesJS version

  • I confirm to use the latest version of GrapesJS

What browser are you using?

v95

Reproducible demo link

https://codesandbox.io/s/grapes-border-issue-forked-2c0ib?file=/src/index.js:10258-10261

Describe the bug

How to reproduce the bug? I am trying to create a custom component, which contains drag end drop feature, and due to the fix of #2904 the draggable attribute is turned off altogether.

What is the expected behavior? The custom component that made intentionally draggable could be previewed as such

What is the current behavior? Currently all of the draggable events are disabled in preview

I am also open to make a pr just first I wanted to discuss which is the best way solve this issue, or maybe this is a design decision of the project.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Answers (4)

artfNovember 22, 2021

Hi @xQwexx what would be your solution in such a case? We still need to keep the D&D disabled in the preview. Can you also post your component code in order to understand better the use case?

no-response[bot]December 2, 2021

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

xQwexxDecember 7, 2021

Hi @artf I updated with a demo, also my suggestion would be that use the attributes: { draggable: 'true'}, indicator if the component is draggable in preview and leave the drag handling for the component template like attributes: { draggable: 'true', ondrop: 'drop(event)' , ondragover: 'allowDrop(event)'} I am not 100% percent sure how it is handled now, but I would change this draggable html tags for false if this attribute is not present, when we change to preview.

ClaudeCodeMay 17, 2026

Thanks for reporting this, @xQwexx.

Great suggestion about Disabled drag and drop in preview! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior.

Using the event system:

editor.on('component:update', (component) => {
  // your logic here
});

Alternative approaches:

  • Listen to selector:add for CSS selector changes
  • Use selector:custom for custom rules
  • Tap into the change:* events for fine-grained tracking
  • Build a plugin that extends the editor with this capability

Making it official: If this feature would benefit many users, consider opening a formal Feature Request on the GrapesJS repo with:

  • A detailed use case
  • Code example showing the desired behavior
  • Why this matters for your workflow

The core team is receptive to well-motivated feature requests backed by real use cases.

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.