Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Drop external folders onto the Tree View to create new project folders#1209

Merged
winstliu merged 2 commits intomasterfrom
wl-external-drop
Dec 7, 2017
Merged

Drop external folders onto the Tree View to create new project folders#1209
winstliu merged 2 commits intomasterfrom
wl-external-drop

Conversation

@winstliu
Copy link
Copy Markdown
Contributor

@winstliu winstliu commented Dec 6, 2017

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

Implements the popularly-requested feature #480. Basically if no existing folder is selected the Tree View adds the entries in the data transfer event as new project folders. There are a few rough edges with this implementation, such as but not limited to:

  • Folders must be dropped to a blank section of the Tree View after the last entry. This means that if the Tree View scrolls you will be unable to create a project folder as the entries will get added to the last project.
    • I would like to add support to be able to create project folders when dropping them between project folders, similar to how root drag-and-drop works currently.
  • Cannot drag and drop folders onto the Tree View when no Tree View exists.

Alternate Designs

No alternatives were considered.

Benefits

External folders can now be dragged-and-dropped into the Tree View to be added as project folders.

Possible Drawbacks

I don't believe there are any drawbacks with this other than the limitations addressed above.

Applicable Issues

Fixes #480

# Drop event from OS
for file in e.dataTransfer.files
@moveEntry(file.path, newDirectoryPath)
else if e.dataTransfer.files.length
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would e.dataTransfer.files be undefined ?

Copy link
Copy Markdown
Contributor Author

@winstliu winstliu Dec 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. files is a standard DataTransfer property that will always be available. https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/files

Copy link
Copy Markdown
Contributor

@liuderchi liuderchi Dec 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info. BTW it says that dataTransfer exists on all drag events. Good News.

@winstliu
Copy link
Copy Markdown
Contributor Author

winstliu commented Dec 7, 2017

I looked into implementing drag-and-drop indicators. It will be harder than I thought because then you'll have to differentiate between moving external folders into existing projects or whether to create a new project folder for it. I'll punt that for a later PR.

@winstliu winstliu merged commit 10a979c into master Dec 7, 2017
@winstliu winstliu deleted the wl-external-drop branch December 7, 2017 13:43
@here
Copy link
Copy Markdown

here commented Mar 7, 2018

Note that as of 2018-03-06 , this request remains unreleased in the Atom core editor with the tree-view core package at v221.3 or v222 based on https://github.com/atom/tree-view/releases

@liuderchi
Copy link
Copy Markdown
Contributor

Share a shell snippet for checking releases

# atom latest releases and corresponding tree-view version
$ curl https://api.github.com/repos/atom/atom/releases/latest -s | grep 'tag_name'

  "tag_name": "v1.24.0",

$ curl https://raw.githubusercontent.com/atom/atom/v1.24.0/package.json -s | grep 'tree-view'

    "tree-view": "0.221.3",

@winstliu
Copy link
Copy Markdown
Contributor Author

winstliu commented Mar 7, 2018

@here we're dealing with tree-view spec failures that need to be fixed before we feel comfortable updating it in Atom itself. Sorry for the delay.

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.

UX - Cannot drag project folder into tree-view

3 participants