decap-cms icon indicating copy to clipboard operation
decap-cms copied to clipboard

Regression from the Slate upgrade: Drag'n'drop of editor components no longer works

Open papandreou opened this issue 7 years ago • 13 comments

Describe the bug

After upgrading to netlify-cms 2, I can no longer use drag and drop to move editor components around.

To Reproduce

  1. Add a new entry to a collection that has a body field
  2. Make sure the body editor is in Markdown mode
  3. Insert an Image component to the body
  4. Insert another image
  5. Try to change the order of the images by dragging the header of one of the images

Nothing happens, I cannot drag the image component anywhere.

This also affects horizontal rulers (- - -), they used to be draggable, but aren't anymore. They could also be deleted by clicking them then pressing backspace. I'm assuming this is all related, so I won't file separate issues for that.

Expected behavior

That a "ghost" of the image component appears and follows the mouse while I'm dragging it.

Screenshots

It's hard to illustrate the exact problem with a screenshot, but here's a setting where dragging the gray bar of the image component no longer works:

screen shot 2018-09-10 at 16 07 52

Applicable Versions:

  • Netlify CMS version: [e.g. 2.0.4]
  • Git provider: [e.g. GitHub, BitBucket]
  • OS: [e.g. Windows 7]
  • Browser version [e.g. chrome 22, safari 11]
  • Node.JS version:

CMS configuration

Not relevant, it's reproducible for any configuration that has a collection with a body with a markdown type.

Additional context

git bisect says the problem was introduced in #1451:

a1677b0e24e62b2b4b88b69e0d8e634f91475e30 is the first bad commit
commit a1677b0e24e62b2b4b88b69e0d8e634f91475e30
Author: Robert Karlsson <[email protected]>
Date:   Thu Aug 23 22:54:55 2018 +0200

    chore: update Slate dependencies (#1451)

:040000 040000 c614fbc676818d0d0f42d110ce21a9b1a5ad814c ef064111d6dfdd86da3ea6aa18c1b78ba819d6dc M	packages
:100644 100644 c2433336fb15a214a8945b1edf7869cd0bbdc622 1d58d5500913be757e4d224dcdd5274c70216176 M	yarn.lock

papandreou avatar Sep 10 '18 14:09 papandreou

@papandreou I did a quick look on this issue but could not see any code changes in the PR causing the specific issue, but it sure is present after the slate update. My best guess is that one or more libraries connected to Slate i out of sync for this to function since the drag do not seem to trigger at all.

I tried to do a few minor upgrades but it didn't seem to solve the issue, and doing major ones breaks everything (latest slate was 0.34 as of that PR, is 0.40.2 as of writing this).

I'm going to further investigate this during this week.

robertkarlsson avatar Sep 10 '18 17:09 robertkarlsson

Not sure if this is us or Slate, upgrading all the way would help narrow it down.

erquhart avatar Oct 01 '18 18:10 erquhart

@erquhart I’ve been meaning to pick this up but it’s been a lot at work lately. I’ll try to look at it soon.

Do you know if the dnd feature that has disappeared is native to slate or is it a feature from the teams side? Upgrading it to the latest version would definitely narrow it down and maybe even solve it if this is built into slate.

It looked like it may be a lot of work to make it run latest slate though, but I guess we want to run it eventually anyway.

robertkarlsson avatar Oct 01 '18 21:10 robertkarlsson

@robertkarlsson, have you made any progress with this? If it's going to be a while, maybe you should consider reverting the slate upgrade? Although that would probably reintroduce that Cmd+z bug...

papandreou avatar Oct 19 '18 10:10 papandreou

@robertkarlsson I'm not certain whether it was an intentional feature in slate. I believe there's some consideration and use of draggable elements in Slate.

erquhart avatar Oct 26 '18 20:10 erquhart

Ping @robertkarlsson?

papandreou avatar May 01 '19 11:05 papandreou

I've been overhauling our slate implementation for a while now, stay tuned.

Sent with GitHawk

erquhart avatar May 01 '19 12:05 erquhart

Friendly ping @erquhart? This is continuing to cause issues for us, as we cannot reorder editor components without dropping into markdown mode.

papandreou avatar Jul 18 '19 12:07 papandreou

Drag and drop got really complicated for some reason. I spent time on during the refactor (releasing very soon, promise), but it still won't work once that's out.

What will work is copy/cut and paste, so hopefully that will work as a stopgap until we get drag and drop going.

erquhart avatar Jul 23 '19 22:07 erquhart

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 29 '19 07:10 stale[bot]

@papandreou the markdown widget work is in #2828.

erquhart avatar Nov 08 '19 22:11 erquhart

@martinjagodic just to confirm, the issue is closed as completed but dnd stills not working, right? At least on demo https://cms-demo.netlify.com/#/collections/posts/entries/2023-08-27-post-number-20 it's not working...

leomp12 avatar Aug 26 '23 17:08 leomp12

@leomp12 you are correct, this is not fixed, thanks.

martinjagodic avatar Aug 28 '23 07:08 martinjagodic