Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

two nodes receiving .ProseMirror-selectnode class in drag event #917

Open
3 tasks
alidcast opened this issue Apr 23, 2019 · 4 comments
Open
3 tasks

two nodes receiving .ProseMirror-selectnode class in drag event #917

alidcast opened this issue Apr 23, 2019 · 4 comments

Comments

@alidcast
Copy link

alidcast commented Apr 23, 2019

Issue details

in a single drag event, there's two nodes receiving the .ProseMirror-selectednode - the original node, and the node being dragged

from gitter discussion, it appears this is a bug, and only the node being dragged should be receiving it.

Steps to reproduce

here's a minimal glitch (try dragging an empty paragraph, and you'll see two selected blocks being styled - I only added the default Prosemirror css)

https://glitch.com/~prosemirror-node-drag

ProseMirror version

 "prosemirror-state": "1.2.2",
 "prosemirror-model": "1.7.0",
 "prosemirror-view": "1.8.1"

Affected platforms

  • [x ] Chrome
  • Firefox
  • Internet Explorer
  • Other

Screenshots / Screencast (Optional)

ezgif-1-809574b89f45

@marijnh
Copy link
Member

marijnh commented Apr 24, 2019

I'm not seeing anything like the screencast in that glitch link—there's no blue line moving along with the dragged paragraph. Also your screencast appears to have drag handles, which are absent in the demo.

@alidcast
Copy link
Author

alidcast commented Apr 24, 2019

oh, sorry if it wasn't clear - that gif was a reproduction of the error in my project but the glitch also has a more minimal reproduction

just created a gif for the glitch as well, here's how that one looks:

ezgif-4-d9883507829b

as you can see above, two nodes are receiving the styling applying to the Prosemirror-selectnode class

note: since there's no handle, you have to drag an empty paragraph to reproduce it - since the bug seems to occur only when dragging entire nodes, not text itself

@marijnh
Copy link
Member

marijnh commented Apr 24, 2019

Okay, I see. When you start dragging, the browser will create screenshot of the dragged element and use that as the cursor. There's no actual second element, I think. Scripts can use dataTransfer.setDragImage to override it, but getting a more appropriate image is... not trivial.

If you want, you can do some research as to whether removing the class for a moment directly after the dragstart event helps, but personally I don't really see this behavior as a big problem.

@alidcast
Copy link
Author

appreciate the explanation. yea it's not a big problem, it just adds unnecessary noise UI wise.

I will experiment with toggling classes to see if that works, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants