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

Issue #566 - Using configuration parameter to allowDragAndDrop of files and folders - #748

Closed
KenBridgeman wants to merge 5 commits into
atom:masterfrom
KenBridgeman:master
Closed

KenBridgeman wants to merge 5 commits into
atom:masterfrom
KenBridgeman:master

Conversation

@KenBridgeman

Copy link
Copy Markdown

This is my very first Javascript as well as OpenSource Pull request. I think I've done OK, but if not please be kind.

package.json: Added allowDragAndDrop attribute with a default value of true which ensures backward compatibility.

directory-view.coffee and file-view.coffee:Simple one-liner to get config item and set draggable attribute in DOM structure.

tree-view.coffee: One-liner to ensure that changes to the config attribute are propagated to the tree-view immediately. Without this line, the user would have to exit the app and restart.

tree-view-spec.coffee: Had the hardest time figuring this out. I seemed to have both closure issues as well as inter-process issues with changing of the config item; but really not sure. In the end, I've got both allowDragAndDrop = true as well as false tests.

@winstliu

Copy link
Copy Markdown
Contributor

So this was discussed before in #623 and ultimately closed as a wontfix, the consensus being that the better solution would to improve the UX of dragging-and-dropping.

Sorry for not catching this earlier and warning you in #566.

/cc @atom/feedback

@KenBridgeman

Copy link
Copy Markdown
Author

That's OK, I learned a ton.

Would you mind very much doing a very quick review and providing a comment as this was my first foray.

children.each (index, child) ->
expect(child).toHaveClass 'expanded'
expect(child.hasAttribute('draggable')).toBe(true)
expect(child.getAttribute('draggable')).toBe('true')

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.

Why do we have two assertions of this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I could be wrong about this, but I interpret hasAttribute as being true regardless of whether draggable's value is true or false; it has the attribute and it's value is 'x'.

I noticed that at the root in DirectoryView that @Draggable is not created and therefore, for root I was thinking that it will not have the attribute at all.

I didn't want the test to error out if the attribute doesn't exist.

Of course, I'm brand new and don't know what I'm doing. ;)

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.

I think the getAttribute assertion would be sufficient. In our test framework, Jasmine, failures don't halt the test, so it will still proceed to execute the next assertion anyway.

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Would you mind very much doing a very quick review and providing a comment as this was my first foray.

Of course! Looking now...

fileView3 = treeView.find('.file:contains(test-file3.txt)')
treeView.updateRoots()

it 'makes expanded directory and files draggable', ->

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.

Shouldn't setting allowDragAndDrop to false disable drag-and-drop?

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.

Nevermind - misread getAttribute vs hasAttribute.

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.

But your comment is still valid: the test description should be something like:

it "prevents directories and files from being dragged", ->

@maxbrunsfeld

Copy link
Copy Markdown
Contributor

Left various minor comments. Other than that, this PR is good! Unfortunately, as @50Wliu mentioned, we have decided not to add this option at this time. In general, we like to avoid a proliferation of settings, where there are alternatives. Thanks for delving into the Atom code, @KenBridgeman; I hope to see more work by you!

@winstliu

winstliu commented May 4, 2017

Copy link
Copy Markdown
Contributor

As the Atom maintainers have agreed that we will not be adding a configuration setting for drag-and-drop, I'm going to close this PR. Thanks again for the contributions @KenBridgeman 😀.

@winstliu winstliu closed this May 4, 2017
@lee-dohm

lee-dohm commented May 4, 2017 •

Copy link
Copy Markdown
Contributor

@strindhaug your comment was deleted as a violation of the Atom Code of Conduct as it was insulting or derogatory. You may consider this an official warning.

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