8000 Only allow drag-and-drop to succeed on panes in the center workspace by winstliu · Pull Request #19251 · atom/atom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Only allow drag-and-drop to succeed on panes in the center workspace #19251

Merged
merged 10 commits into from
Sep 29, 2021

Conversation

winstliu
Copy link
Contributor
@winstliu winstliu commented May 2, 2019

Requirements for Adding, Changing, or Removing a Feature

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must contribute a change that has been endorsed by the maintainer team. See details in the template below.
  • The pull request must update the test suite to exercise the updated functionality. For guidance, please see https://flight-manual.atom.io/hacking-atom/sections/writing-specs/.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see https://github.com/atom/atom/tree/master/CONTRIBUTING.md#pull-requests.

Issue or RFC Endorsed by Atom's Maintainers

Admittedly, this has not been endorsed by any maintainers (other than the fact that I'm submitting a PR for it now as a maintainer?).

Description of the Change

Previously, we would accept any drop request as valid in a drag-and-drop operation, regardless if we would actually do anything with it. Before signaling that a drop would be valid, we now check that 1) files are included in the drag store, and 2) the pane is in the workspace center.

The first check is entirely visual - this is to prevent the drop effect from changing to "move" instead of staying as "none" if the potential drop operation would be invalid.

The second check has an additional functional change - attempting to drop files onto docks no longer does anything. This is to prevent confusion, as TextEditors can only be opened in the center of the workspace, and I thought it was best to be explicit about that, even when initiating a drop operation. (Previously, dropping onto a dock would open the TextEditor in the workspace center, not the dock itself.)

Note: with this change, my drop effect on Windows is "copy" instead of "none" when the event is not prevented, and I can't figure out why. Maybe it's just a bug with Windows?
Edit: Maybe I need to look at 71a2797?

Alternate Designs

None.

Possible Drawbacks

You now must drop a file in the center workspace for a new TextEditor to be created.

Verification Process

  • Dragging a file into the workspace center still opens a new TextEditor
  • Dragging a file into a dock (e.g. the Git tab) does not do anything
  • Dragging text into the workspace center does not do anything
  • Dragging text into a dock does not do anything

Release Notes

N/A

@rafeca
Copy link
Contributor
rafeca commented May 31, 2019

Hey! 👋

We have recently started using prettier and this has caused major style changes on the Atom JS codebase (you can check the related PR).

This is good news: now the Atom code is more consistent and it's much easier to re-format the code to
follow the codestyle (now you only need to run script/lint --fix).

This change caused conflicts on your PR that we have automatically solved, hope you don't mind 😄

With ❤️, the Atom team.

@sadick254
Copy link
Contributor

@50Wliu Good work on the PR. The PR is still in draft mode. What could be holding it back from being ready for review?

@winstliu
Copy link
Contributor Author
winstliu commented Sep 4, 2021

I don't remember 😅. Regardless, I'll resolve the conflicts, and see if anything sparks my memory while doing so.

@winstliu winstliu marked this pull request as ready for review September 14, 2021 03:03
@winstliu
Copy link
Contributor Author

What could be holding it back from being ready for review?

Okay, my guess is just I wasn't satisfied with the drop effects not lining up as expected. This is still probably worth merging if the unit tests pass though and you can verify that dropping files on non-center panes don't create files.

@darangi
Copy link
Contributor
darangi commented Sep 28, 2021

@50Wliu, the tests aren't passing : ( Do you think you have the time to work on this?

What could be holding it back from being ready for review?

Okay, my guess is just I wasn't satisfied with the drop effects not lining up as expected. This is still probably worth merging if the unit tests pass though and you can verify that dropping files on non-center panes don't create files.

@winstliu
Copy link
Contributor Author

Looking at my old CoffeeScript tests, I somehow completely butchered moving them to JavaScript. Let me fix that now...

@winstliu
Copy link
Contributor Author

It's 💚💚💚!

@darangi
Copy link
Contributor
darangi commented Sep 29, 2021

Awesome stuff! Thanks for the contribution @50Wliu 🙇🏾

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

Successfully merging this pull request may close these issues.

4 participants
0