grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

BUG: Disabled drag and drop in preview

Open xQwexx opened this issue 3 years ago • 5 comments

GrapesJS version

  • [X] 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

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

xQwexx avatar Nov 13 '21 04:11 xQwexx

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?

artf avatar Nov 22 '21 14:11 artf

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.

no-response[bot] avatar Dec 02 '21 15:12 no-response[bot]

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.

xQwexx avatar Dec 07 '21 21:12 xQwexx

I don't think a page builder should be used for such cases. For example, if your drag & drop generates some actions (like ajax post to server to save new positions or w/e), what would you do ? allow ajax actions in preview mode ? do not save positions ? Seems overkilled. This is not a bug, it's a weird feature you are asking for.

vince83110 avatar Jan 23 '22 18:01 vince83110

For example, if your drag & drop generates some actions (like ajax post to server to save new positions or w/e), what would you do ?

I would say yes because the preview view purpose is to test the code, so you can be sure that it works correctly after deployment. In this cases I would say it is the developer job to set up a development server so you not updating the prod server data. But I think that part optional because not every use case needs it.

xQwexx avatar Jan 24 '22 17:01 xQwexx