-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Select and drag text in the editor is broken, can recreate this on draftjs.org #1454
Comments
Aha - I was testing on Firefox. This is indeed easy to reproduce on Chrome, and what an awful bug! Thanks for reporting it! I'd love to get a PR fixing it. This seems recent - I'm surprised I didn't catch it when manually testing in the past. You mentioned being able to reproduce it in 0.10.1 - I wonder if it's a problem introduced by a Chrome version update rather than a change in Draft. Either way, would be great to get a fix. If nobody picks this up I'll look into it when I have time. |
I tried this on Mac Chrome and seems to be working fine. |
Thanks for commenting @itsujan - I just tried again and was not able to reproduce it. I'm using Chrome |
👍 Works all good for me too at Version 62.0.3202.75 🍏 |
I'm actually able to reproduce on OSX Chrome I'm pretty sure this is in the code and not a browser issue. It seems Notice in the above clip that when I have a scratch fix working locally, so I can take this and open a PR soon when I can clean it up. |
@nickpassarella Awesome! Please feel free to submit a PR to this! |
Thanks @jackyho112 - it would be great to get a fix in for this. |
Fixed issue facebookarchive#1454 (partial) Fixed issue facebookarchive#1383
Fixed issue facebookarchive#1434
Fixed issue facebookarchive#1454 (partial) Fixed issue facebookarchive#1383
Fixed issue facebookarchive#1434
Summary: **Summary** Fixes issue #1383. Fixes problem which is: onDrop breaks onSelect/onChange events. Fixes issue #1454 (partial). Fixes problem which is: after first internal drop dragged text will not be moved to target position, but copied. The solution is to set `editor._internalDrag` to false not during onDragOver events, but after end of drag-n-drop. **Test Plan** Attached reproducable videos (on Chrome for Linux) Issue #1383 before and after: ![1383-before](https://user-images.githubusercontent.com/3238637/46585340-68ec4100-ca78-11e8-9c2f-c98e7cb381ff.gif) ![1383-after](https://user-images.githubusercontent.com/3238637/46585344-6c7fc800-ca78-11e8-9c2e-fdac5594d1d0.gif) Issue #1454 before and after: ![1454-before](https://user-images.githubusercontent.com/3238637/46585364-9e912a00-ca78-11e8-9c17-5dfcec5a2e16.gif) ![1454-after](https://user-images.githubusercontent.com/3238637/46585361-9a650c80-ca78-11e8-8b7f-dac6c6af4b23.gif) Pull Request resolved: #1599 Differential Revision: D10236073 fbshipit-source-id: 3b7b816630f3b5b15931cb53782a1d5b9e9d5121
Summary: **Summary** Fixes issue facebookarchive#1383. Fixes problem which is: onDrop breaks onSelect/onChange events. Fixes issue facebookarchive#1454 (partial). Fixes problem which is: after first internal drop dragged text will not be moved to target position, but copied. The solution is to set `editor._internalDrag` to false not during onDragOver events, but after end of drag-n-drop. **Test Plan** Attached reproducable videos (on Chrome for Linux) Issue facebookarchive#1383 before and after: ![1383-before](https://user-images.githubusercontent.com/3238637/46585340-68ec4100-ca78-11e8-9c2f-c98e7cb381ff.gif) ![1383-after](https://user-images.githubusercontent.com/3238637/46585344-6c7fc800-ca78-11e8-9c2e-fdac5594d1d0.gif) Issue facebookarchive#1454 before and after: ![1454-before](https://user-images.githubusercontent.com/3238637/46585364-9e912a00-ca78-11e8-9c17-5dfcec5a2e16.gif) ![1454-after](https://user-images.githubusercontent.com/3238637/46585361-9a650c80-ca78-11e8-8b7f-dac6c6af4b23.gif) Pull Request resolved: facebookarchive#1599 Differential Revision: D10236073 fbshipit-source-id: 3b7b816630f3b5b15931cb53782a1d5b9e9d5121
Summary: **Summary** Fixes issue facebookarchive#1383. Fixes problem which is: onDrop breaks onSelect/onChange events. Fixes issue facebookarchive#1454 (partial). Fixes problem which is: after first internal drop dragged text will not be moved to target position, but copied. The solution is to set `editor._internalDrag` to false not during onDragOver events, but after end of drag-n-drop. **Test Plan** Attached reproducable videos (on Chrome for Linux) Issue facebookarchive#1383 before and after: ![1383-before](https://user-images.githubusercontent.com/3238637/46585340-68ec4100-ca78-11e8-9c2f-c98e7cb381ff.gif) ![1383-after](https://user-images.githubusercontent.com/3238637/46585344-6c7fc800-ca78-11e8-9c2e-fdac5594d1d0.gif) Issue facebookarchive#1454 before and after: ![1454-before](https://user-images.githubusercontent.com/3238637/46585364-9e912a00-ca78-11e8-9c17-5dfcec5a2e16.gif) ![1454-after](https://user-images.githubusercontent.com/3238637/46585361-9a650c80-ca78-11e8-8b7f-dac6c6af4b23.gif) Pull Request resolved: facebookarchive#1599 Differential Revision: D10236073 fbshipit-source-id: 3b7b816630f3b5b15931cb53782a1d5b9e9d5121
Hi, what is the status of this issue? I have tried it on 0.11.4 as well as on draftjs.org, and I can still see some problems. In particular when you drag the text forward on the same line, the target index does not subtract the length of the dragged text, placing it much further in the text than it should. When it lands after the end of the text, it even makes the editor content inconsistent. In addition to that, we drag and drop custom blocks using external drag and drop functionality, and we face an issue that the editor sometimes sets its mode to Is there some way to completely disable drag and drop handling by the editor? |
I am also trying to figure out the status of this issue. As far as I can see, where were pull requests addressing the problem but none of them was accepted. Can anyone help understand how to fix this bug? |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
Select and drag text in the editor is broken, causes unpredictable behaviour.
Can recreate this on draftjs.org
Ubuntu:
Chromium Version 61.0.3163.100
Firefox Version 56.0
Windows:
Chrome
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You can use this jsfiddle to get started: **
Go to draftjs.org, enter a sentence into the editor, double click the first word to highlight it and drag it to another location in the editor.
The observed result is near different each time and is not what is expected, sometimes the dragged word remains in the original location and in the drop location, sometimes it is placed a few characters after the drop location.
It is tested at https://draftjs.org/
What is the expected behavior?
Move the selected text to the desired caret position.
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
It is tested at https://draftjs.org/
Version 0.10.1
Version 0.10.4
The text was updated successfully, but these errors were encountered: