Skip to content

rebase Multi drag #1

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

Closed
wants to merge 337 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
337 commits
Select commit Hold shift + click to select a range
d0c1488
Merge pull request #930 from Alhadis/start-fix
Aug 29, 2016
7ef8c72
Prepare 0.209.3 release
winstliu Aug 29, 2016
5981f47
Fire events when creating, moving or deleting items
Alhadis Sep 7, 2016
c088550
Add TreeView methods to attach file-event handlers
Alhadis Sep 7, 2016
1488a66
Add specs for 5981f47 and c088550
Alhadis Sep 7, 2016
74b1b7e
Fix typos and polish punctuation of spec titles
Alhadis Sep 7, 2016
1ea59e7
Merge branch 'master' into drag-and-drop-root
forivall Oct 5, 2016
0ae4993
Add description to Always Open Existing
phoenixeliot Oct 5, 2016
7af1a21
Merge pull request #951 from phoenixeliot/describe-always-open-existing
Oct 6, 2016
84bfbf0
:art: refine item name in context-menu
liuderchi Oct 6, 2016
57c3bfb
Merge pull request #881 from liuderchi/show-current-file-in-file-mana…
Oct 6, 2016
aae11b1
Prepare 0.210.0 release
winstliu Oct 6, 2016
3242249
make dragging files and project roots mutually exclusive
forivall Oct 11, 2016
1a317b5
Allow drag / dropping project folders to empty space
forivall Oct 18, 2016
702ee4f
Ensure that placeholder doesn't disappear above the top of tree view
forivall Oct 18, 2016
93a6b81
add test for when dragging below all entries
forivall Oct 18, 2016
34df5f4
Fix dragging between windows for deprecated ipc
forivall Oct 19, 2016
9d0f158
Fix test for deprecation fix
forivall Oct 19, 2016
dff6350
remove deprecated use of remote.require('browser-window')
forivall Oct 19, 2016
14c1558
Refactor to shorten name of drag and drop handler
forivall Oct 21, 2016
d5c39ce
Properly remove rootDragAndDrop handler on deactivate
forivall Oct 21, 2016
f2e23fe
Improve performance of placeholder rendering
forivall Oct 23, 2016
8fb43e5
Clean up event handling
forivall Oct 24, 2016
aab2f78
Fix specs for refactored event handling
forivall Oct 24, 2016
8b9a607
Remove unecessary will-change rule
forivall Oct 24, 2016
cb14702
Fix lint warning
forivall Oct 24, 2016
c637521
Fix dragging jank by not placing placeholder if not needed
forivall Oct 25, 2016
0535752
Remove useless removeDropTargetClasses
forivall Oct 25, 2016
edf9e5b
Switch positioning of placeholder to use entire entry instead of header
forivall Oct 25, 2016
7dbae50
Use a different signifier than tab events
forivall Oct 25, 2016
8ebef1e
Merge pull request #525 from forivall/drag-and-drop-root
Oct 26, 2016
d6f0a5e
Prepare 0.211.0 release
Oct 26, 2016
34a5e1d
Merge branch 'master' into file-events
Alhadis Oct 28, 2016
7f12c13
Remove unnecessary onWillDeactivate method from file-icons service
maxbrunsfeld Oct 28, 2016
c6052c0
Merge pull request #967 from atom/mb-update-file-icons-service
Oct 28, 2016
8a7f1c3
Prepare 0.211.1 release
maxbrunsfeld Oct 28, 2016
75bb6b6
Merge branch 'master' into file-events
Alhadis Oct 29, 2016
1e23411
Remove min-height
simurai Nov 18, 2016
d3d524f
Merge pull request #761 from paradoxxxzero/master
damieng Dec 1, 2016
bc997fe
:memo: Update issue and PR templates
lee-dohm Dec 22, 2016
fd37178
Merge pull request #1004 from atom/template-update
lee-dohm Dec 22, 2016
0da839a
:memo: Update issue and PR templates
lee-dohm Dec 26, 2016
d0897e4
Merge pull request #1006 from atom/template-update
lee-dohm Dec 26, 2016
289771b
:bug: Solve bug mentioned in issue #1005
mcampagonzalez Dec 29, 2016
96d8de2
Merge pull request #1008 from miguelcg/fix/unsquash_deleted_directories
Dec 31, 2016
6fa05d3
Prepare 0.212.0 release
winstliu Dec 31, 2016
22c06ea
Cover trash failures for macOS and Windows with a message
lee-dohm Jan 2, 2017
80a0a26
:racehorse: Update roots after deletion only if `tree-view.squashDire…
mcampagonzalez Jan 2, 2017
9ad2d19
:bug: Solve bug mentioned in issue #702
mcampagonzalez Jan 2, 2017
1657296
Improve the win32 message
lee-dohm Jan 2, 2017
eb47421
Make tests windows-friendly using #{path.sep} instead of "/"
mcampagonzalez Jan 2, 2017
1b5c7d8
:bug: Prevent root directories to be squashed
mcampagonzalez Jan 2, 2017
b57e610
Solve minor wording issue in test
mcampagonzalez Jan 2, 2017
7b157c1
Merge pull request #1013 from miguelcg/fix/root_folder_displayed_squa…
lee-dohm Jan 2, 2017
b62a05a
Merge pull request #1011 from atom/better-error-message
lee-dohm Jan 3, 2017
cf00ccc
:art: Improve the no trash notification formatting
lee-dohm Jan 3, 2017
5f000b1
Merge pull request #1014 from atom/improve-notification
lee-dohm Jan 3, 2017
d46f8e6
Remove unnecessary new-line
mcampagonzalez Jan 4, 2017
7b79016
Add comments
mcampagonzalez Jan 4, 2017
0f84437
Merge pull request #1012 from miguelcg/fix/removing_entry_updates_squ…
Jan 4, 2017
b5c2755
Merge branch 'master' into file-events
Alhadis Jan 4, 2017
a61c77e
Prepare 0.213.0 release
lee-dohm Jan 4, 2017
045925a
Don't assume that buffers' paths are real paths in spec
maxbrunsfeld Jan 5, 2017
9d704e7
Prepare 0.213.1 release
maxbrunsfeld Jan 5, 2017
32a3b82
Use Node 6
Jan 5, 2017
cc82243
Merge pull request #1017 from atom/wl-fix-appveyor
Jan 5, 2017
1a1d6f3
Merge remote-tracking branch 'refs/remotes/origin/master' into wl-fix…
winstliu Jan 5, 2017
fab5074
Resolve conflicts with v0.213.1
Alhadis Jan 6, 2017
3c33bb8
Merge pull request #791 from atom/wl-fix-windows-specs
damieng Jan 11, 2017
6f27db9
Manually close editors for files deleted from tree view
iolsen Jan 18, 2017
d8147e9
Merge branch 'master' into sm-min-height
simurai Jan 24, 2017
468cfff
Merge pull request #989 from atom/sm-min-height
simurai Jan 24, 2017
dd4bb20
Prepare 0.213.2 release
simurai Jan 24, 2017
ab9e07a
Merge pull request #1026 from atom/io-destroy-deleted-editors
iolsen Jan 25, 2017
a876afb
Prepare 0.214.0 release
iolsen Jan 25, 2017
1611ee3
Start removing jQuery from tests
Jan 30, 2017
e61ffab
Remove jQuery from more specs
Jan 30, 2017
7b892df
Remove jQuery from tests exercising the `squashedDirectoryName` option
Jan 31, 2017
86caaef
Finish removing jQuery from tree-view-spec.coffee
Jan 31, 2017
6bb458d
:art:
Jan 31, 2017
e61908f
Start fixing actual failures on Windows
Jan 31, 2017
8e75f7a
Fix more failing tests on Windows
Jan 31, 2017
d281e64
:art:
Jan 31, 2017
4a66cf5
Fix last failing tests on Windows
Jan 31, 2017
7db1fc6
Run symlink test only on Darwin
Jan 31, 2017
ad4e366
:arrow_up: pathwatcher 6.8.0-1
Feb 1, 2017
620b2d1
Fix tests on Windows
Feb 1, 2017
48d10d8
:arrow_up: pathwatcher 6.8.1
Feb 3, 2017
4257605
Merge pull request #1029 from atom/as-fix-windows-tests-2
Feb 3, 2017
47917b1
Merge branch 'master' into as-remove-jquery
Feb 3, 2017
2113388
Stop using space-pen in dialogs
Feb 3, 2017
77883b0
Stop using space-pen in TreeView
Feb 3, 2017
2ffc575
Resolve conflicts with v0.214.0
Alhadis Feb 6, 2017
baaaf11
Remove custom elements
Feb 3, 2017
3dd711b
Add missing `updateStatus` method on FileView elements
Feb 6, 2017
db34b85
Remove atom-space-pen-views from package.json
Feb 6, 2017
31c472d
Ignore user clicks on the tree-view's background
Feb 6, 2017
5c65c5b
Don't throw an error if canceling a dialog when the tree-view is hidden
Feb 6, 2017
4573a61
Revert ":arrow_up: pathwatcher 6.8.1"
damieng Feb 8, 2017
c345457
Ensure open in file explorer works, fixes #1034
damieng Feb 8, 2017
b2c609f
Focused tests... we should add a linter rule
damieng Feb 8, 2017
a9f01d4
Prepare 0.214.1 release
Feb 8, 2017
a7e7be1
Ensure an entry is selected before performing certain actions
Feb 13, 2017
a13053b
Require tree-view eagerly
Mar 2, 2017
411f199
Merge pull request #1032 from atom/as-remove-jquery
Mar 3, 2017
4a489c6
Prepare 0.215.0 release
Mar 3, 2017
4663e3c
:arrow_up: pathwatcher
Mar 3, 2017
461d8b0
Prepare 0.215.1 release
Mar 3, 2017
271949c
Resolve conflicts with v0.215.1
Alhadis Mar 3, 2017
a7251ff
:arrow_up: fs-plus and pathwatcher
Mar 6, 2017
3beaa0b
Prepare 0.215.2 release
Mar 6, 2017
6d07f77
Update editor paths when containing directory is renamed via move dialog
kuychaco Mar 10, 2017
081ead9
Update editor paths when containing directory is renamed via drag'n'drop
kuychaco Mar 10, 2017
49c6893
Extract helper method updateEditorsForPath
kuychaco Mar 10, 2017
06d227f
Close editors when containing directory is removed
kuychaco Mar 10, 2017
9b17cab
Only check panes in center
matthewwithanm Mar 16, 2017
897fa1b
Merge pull request #1047 from matthewwithanm/fb-mdt-docks-tests
Mar 20, 2017
d90a0c2
Prepare 0.215.3 release
maxbrunsfeld Mar 20, 2017
95fb486
Merge branch 'file-events' of https://github.com/Cutlery-Drawer/tree-…
Mar 25, 2017
15f87c7
Update Move and CopyDialog to take callbacks
Mar 25, 2017
2642b82
Standardize event params
Mar 25, 2017
b86a328
Update tests
Mar 25, 2017
425f396
:fire: console.log
Mar 25, 2017
9a5e04b
Betterer names
Mar 25, 2017
b17769f
Merge ku-mkt-udpate-editors-after-folder-operations, using new strategy
Mar 25, 2017
b5d228d
Use new hooks for updating editors
Mar 25, 2017
9993b8f
Merge pull request #1049 from atom/mkt-events-and-editor-updates
Mar 27, 2017
0dbc6c9
Prepare 0.216.0 release
Mar 27, 2017
771f76e
Display the correct drag image on Electron >= 1.14
Mar 29, 2017
c3725a6
Fix missing drop indicator on Electron >= 1.14
Mar 29, 2017
c6b2269
Fix tests
Mar 29, 2017
1c1366c
Merge pull request #1054 from atom/as-fix-clipped-drag-image
Mar 30, 2017
5227c7d
Merge pull request #1055 from atom/as-fix-missing-drop-indicator
Mar 30, 2017
e7b9451
Prepare 0.216.1 release
Mar 30, 2017
98f08ef
Convert lib/main.coffee to JS
Mar 31, 2017
8caafbf
Extract package singleton class for easier testing
Mar 31, 2017
eebc217
:art:
Mar 31, 2017
9a70d1e
WIP: Start on making tree view a dock item
Mar 31, 2017
ee303b4
Correctly update scroll position after deserializing
Apr 3, 2017
beb468c
Apply .tree-view class to root element to simplify focus handling
Apr 3, 2017
e9e517f
Pass view directly to Workspace.open
Apr 4, 2017
81bc7f9
Get all but one test passing
Apr 4, 2017
f9704d4
Recreate tree-view properly after its pane is closed
maxbrunsfeld Apr 4, 2017
dcb69da
Implement getPreferredWidth on tree view to support resize-to-fit
Apr 5, 2017
74a3404
Prepare 0.217.0-0 release
maxbrunsfeld Apr 5, 2017
96b4940
Fix rendering artifacts
Apr 6, 2017
823033d
Prepare 0.217.0-1 release
Apr 6, 2017
a654ac7
`.tree-view.full-menu` :point_right: `.tree-view .full-menu`
smashwilson Apr 6, 2017
cc834a9
Prepare 0.217.0-2 release
Apr 6, 2017
9523fb5
Update calls to Dock.isOpen to use .isVisible
maxbrunsfeld Apr 7, 2017
a27cfa8
Handle new the workspace's new active pane container behavior
maxbrunsfeld Apr 7, 2017
9e05f14
0.217.0-3
maxbrunsfeld Apr 7, 2017
25f4e10
Show tree view without focusing it when project paths change
maxbrunsfeld Apr 17, 2017
d5b137a
Don't try to destroy TreeView using Pane.close
maxbrunsfeld Apr 17, 2017
c166bb3
Avoid exception when tree-view is deactivated right after project pat…
maxbrunsfeld Apr 17, 2017
8d68369
Prepare 0.217.0-4 release
maxbrunsfeld Apr 17, 2017
c8cb0be
Don't focus the tree-view whenever active pane item changes
maxbrunsfeld Apr 17, 2017
35a2742
Prepare 0.217.0-5 release
maxbrunsfeld Apr 17, 2017
5589861
Make list inherit its container's width
maxbrunsfeld May 4, 2017
210fada
Merge pull request #1089 from atom/mb-full-width-list
May 4, 2017
73acb41
Prepare 0.217.0-6 release
maxbrunsfeld May 4, 2017
755e781
Prepare 0.217.0-7 release
maxbrunsfeld May 4, 2017
cf15382
Make specs pass with mocked Date.now
May 12, 2017
0c133af
Prepare 0.217.0-8 release
May 12, 2017
8b89251
Fix lint error
maxbrunsfeld May 16, 2017
0a225ba
Merge pull request #1056 from atom/ns-mb-dock-item
May 16, 2017
66aca88
Prepare 0.217.0 release
maxbrunsfeld May 16, 2017
72a345c
Expand to full-height
simurai May 20, 2017
ec1f8be
Expand to full width
simurai May 20, 2017
6e0dff9
fix unselect multiple entiries on right click
UziTech May 22, 2017
ba9b331
add test
UziTech May 23, 2017
cf749cd
Merge pull request #1111 from atom/sm-move-to-docks-fixes
iolsen May 24, 2017
d244b9d
Prepare 0.217.1 release
iolsen May 24, 2017
7f8e037
🐛⌨ Restore ability for `escape` to return focus to center
jasonrudolph Jun 9, 2017
a31d1bd
Merge pull request #1127 from atom/jr-escape-to-center
jasonrudolph Jun 9, 2017
2896cce
Prepare 0.217.2 release
jasonrudolph Jun 9, 2017
01ff0b2
Merge branch 'master' of https://github.com/atom/tree-view into patch-1
UziTech Jun 15, 2017
9b0f8e1
Fix multi-select shifting
simurai Jun 16, 2017
2329f92
Eagerly reload parent directory after creating a file.
maxbrunsfeld Jun 16, 2017
b8b1d10
Improve expandDirectory logic
Jun 19, 2017
0d7afc0
Merge pull request #1132 from atom/wl-expand-directory-improvements
Jun 19, 2017
53a83f8
Remove TODO
Jun 19, 2017
b8f09a9
Remove unused `expectDockItem` parameter
Jun 19, 2017
26a43d8
Merge pull request #1133 from atom/wl-spec-cleanup
Jun 19, 2017
0d05497
Use getFullExtension instead of path.extname in dialogs
Ingramz May 17, 2016
7ca7d8d
Fix path.basename being applied twice
Ingramz May 17, 2016
f9368ef
Add specs
Jun 19, 2017
410357e
Merge pull request #1134 from atom/wl-ingramz-use-get-full-extension
Jun 19, 2017
59600c7
Merge branch 'pr/230' into wl-deiga-focus-parent-on-deletion
Jun 20, 2017
e4dc741
Improve implementation and add specs
Jun 20, 2017
3bb99c2
Merge pull request #1135 from atom/wl-deiga-focus-parent-on-deletion
Jun 20, 2017
09e1aae
Don't try to delete entries which no longer exist
Jun 20, 2017
3a4d66f
Merge pull request #1137 from atom/wl-dont-double-delete
Jun 20, 2017
a193a44
Prepare 0.217.3 release
Jun 22, 2017
6f72f97
add check for multi-select
UziTech Jul 7, 2017
6f40ed4
Merge pull request #1130 from atom/sm-tree-view-root
simurai Jul 21, 2017
cde1d9d
Prepare 0.217.4 release
simurai Jul 21, 2017
aea3d78
Merge remote-tracking branch 'refs/remotes/atom/master' into patch-1
UziTech Jul 21, 2017
acdc16b
Merge remote-tracking branch 'refs/remotes/atom/master' into patch-1
UziTech Jul 21, 2017
bff166c
use treeView.onMouseDown
UziTech Jul 21, 2017
8d28d89
Merge pull request #1115 from UziTech/patch-1
Jul 21, 2017
1043f55
Prepare 0.217.5 release
Jul 21, 2017
55e1b25
Fix flaky test re: adding new file
jasonrudolph Aug 1, 2017
cf69a85
:art:
jasonrudolph Aug 2, 2017
2b5aca7
Increase clarity of `waitsFor` block
jasonrudolph Aug 2, 2017
6bb7005
Fix other flaky test re: adding new file
jasonrudolph Aug 2, 2017
551f767
Merge pull request #1156 from atom/jr-fix-1155
jasonrudolph Aug 2, 2017
3c94289
Prepare 0.217.6 release
jasonrudolph Aug 2, 2017
76cb5ef
:arrow_up: pathwatcher
maxbrunsfeld Aug 18, 2017
464e60d
Prepare 0.217.7 release
maxbrunsfeld Aug 18, 2017
b7720ac
Improve tree-view:remove-project-folder reliability
Aug 22, 2017
a2c2030
Factor the root folder into account when revealing the active file
Aug 22, 2017
3e4ca12
Merge pull request #1166 from atom/wl-remove-project-folder-improvements
Aug 22, 2017
a0e553f
Merge pull request #1167 from atom/wl-reveal-active-file
Aug 22, 2017
23516fe
Switch internal directory representation to use maps
Aug 23, 2017
f40e224
Fix scroll jerking
RobertBColton Aug 23, 2017
f2712ed
Serialization conversion
Aug 24, 2017
6c2da58
Let's do some proper recursive conversion
Aug 24, 2017
c8fc461
Test conversion logic
Aug 24, 2017
55af47b
Add spec for `__proto__` entries
Aug 24, 2017
c39b672
Use parameter for centering
RobertBColton Aug 28, 2017
b3ab46d
style conventions do not permit whitespace around parameter defaults
RobertBColton Aug 28, 2017
b7eb9b4
Update package spec to test centering
RobertBColton Aug 28, 2017
aa1ca5a
Merge pull request #1171 from RobertBColton/master
Aug 28, 2017
b954663
Prepare 0.217.8 release
Ben3eeE Aug 29, 2017
c68e866
Make tests run with promise and non-promise package deactivate
damieng Sep 8, 2017
805fe49
Merge pull request #1177 from atom/dg-fix-test-with-async-deactivateP…
damieng Sep 8, 2017
1384073
Prepare 0.217.9 release
damieng Sep 8, 2017
f77b84f
:racehorse:
Sep 8, 2017
d8b04dc
Merge pull request #1169 from atom/wl-use-maps
Sep 14, 2017
67e1b0b
Prepare 0.218.0 release
Sep 14, 2017
fce152d
allow mutliple dragging
anderoonies Mar 31, 2016
6276882
refactor event helpers for multiple targets in drag
anderoonies Apr 1, 2016
466281a
spec for multi-drag
anderoonies Apr 1, 2016
d32107c
move files before their containing dir
anderoonies Apr 2, 2016
8078e40
Don't drag dir entries on multi-drag
anderoonies May 26, 2016
1cbce0e
collapse directories on drag for pretty dragImage
anderoonies May 26, 2016
2c21aa5
spec dragging a directory and files to a new directory
anderoonies May 26, 2016
1433595
refactor drag image, clicking logic
anderoonies May 30, 2016
2a58d00
fix merge leftovers
UziTech Aug 30, 2017
2c3bf31
select on mouse up
UziTech Aug 31, 2017
f7243a5
build drag events for multiple files
UziTech Aug 31, 2017
804d5e7
remove jquery from tests
UziTech Aug 31, 2017
f63adcd
remove redundant test
UziTech Aug 31, 2017
1cb4a89
test onmouseup
UziTech Aug 31, 2017
da5b0a5
fix drag image
UziTech Aug 31, 2017
4318f69
do nothing if dropped on one of the dragged
UziTech Aug 31, 2017
40ca6a1
fix shift + ctrl click
UziTech Aug 31, 2017
fc41a97
return empty array if shift+click in other folder
UziTech Aug 31, 2017
2802c7b
refactor
UziTech Sep 1, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--

Have you read Atom's Code of Conduct? By filing an Issue, you are expected to comply with it, including treating everyone with respect: https://github.com/atom/atom/blob/master/CODE_OF_CONDUCT.md

Do you want to ask a question? Are you looking for support? The Atom message board is the best place for getting support: https://discuss.atom.io

-->

### Prerequisites

* [ ] Put an X between the brackets on this line if you have done all of the following:
* Reproduced the problem in Safe Mode: http://flight-manual.atom.io/hacking-atom/sections/debugging/#using-safe-mode
* Followed all applicable steps in the debugging guide: http://flight-manual.atom.io/hacking-atom/sections/debugging/
* Checked the FAQs on the message board for common solutions: https://discuss.atom.io/c/faq
* Checked that your issue isn't already filed: https://github.com/issues?utf8=✓&q=is%3Aissue+user%3Aatom
* Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages

### Description

[Description of the issue]

### Steps to Reproduce

1. [First Step]
2. [Second Step]
3. [and so on...]

**Expected behavior:** [What you expect to happen]

**Actual behavior:** [What actually happens]

**Reproduces how often:** [What percentage of the time does it reproduce?]

### Versions

You can get this information from copy and pasting the output of `atom --version` and `apm --version` from the command line. Also, please include the OS and what version of the OS you're running.

### Additional Information

Any additional information, configuration or data that might be necessary to reproduce the issue.
28 changes: 28 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
### 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

<!--

We must be able to understand the design of your change from this description. If we can't get a good idea of what the code will be doing from the description here, the pull request may be closed at the maintainers' discretion. Keep in mind that the maintainer reviewing this PR may not be familiar with or have worked with the code here recently, so please walk us through the concepts.

-->

### Alternate Designs

<!-- Explain what other alternates were considered and why the proposed version was selected -->

### Benefits

<!-- What benefits will be realized by the code change? -->

### Possible Drawbacks

<!-- What are the possible side-effects or negative impacts of the code change? -->

### Applicable Issues

<!-- Enter any applicable Issues here -->
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ The Tree View displays icons next to files. These icons are customizable by inst
The `atom.file-icons` service must provide the following methods:

* `iconClassForPath(path)` - Returns a CSS class name to add to the file view
* `onWillDeactivate` - An event that lets the tree view return to its default icon strategy
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ environment:
- ATOM_CHANNEL: beta

install:
- ps: Install-Product node 4
- ps: Install-Product node 6

build_script:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/atom/ci/master/build-package.ps1'))
Expand Down
1 change: 1 addition & 0 deletions keymaps/tree-view.cson
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
'alt-left': 'tree-view:recursive-collapse-directory'
'h': 'tree-view:collapse-directory'
'enter': 'tree-view:open-selected-entry'
'escape': 'tree-view:unfocus'
'ctrl-C': 'tree-view:copy-full-path'
'm': 'tree-view:move'
'f2': 'tree-view:move'
Expand Down
10 changes: 8 additions & 2 deletions lib/add-dialog.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ class AddDialog extends Dialog
select: false
iconClass: if isCreatingFile then 'icon-file-add' else 'icon-file-directory-create'

onDidCreateFile: (callback) ->
@emitter.on('did-create-file', callback)

onDidCreateDirectory: (callback) ->
@emitter.on('did-create-directory', callback)

onConfirm: (newPath) ->
newPath = newPath.replace(/\s+$/, '') # Remove trailing whitespace
endsWithDirectorySeparator = newPath[newPath.length - 1] is path.sep
Expand All @@ -44,11 +50,11 @@ class AddDialog extends Dialog
else
fs.writeFileSync(newPath, '')
repoForPath(newPath)?.getPathStatus(newPath)
@trigger 'file-created', [newPath]
@emitter.emit('did-create-file', newPath)
@close()
else
fs.makeTreeSync(newPath)
@trigger 'directory-created', [newPath]
@emitter.emit('did-create-directory', newPath)
@cancel()
catch error
@showError("#{error.message}.")
6 changes: 4 additions & 2 deletions lib/copy-dialog.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Dialog = require './dialog'

module.exports =
class CopyDialog extends Dialog
constructor: (@initialPath) ->
constructor: (@initialPath, {@onCopy}) ->
super
prompt: 'Enter the new path for the duplicate.'
initialPath: atom.project.relativize(@initialPath)
Expand All @@ -32,8 +32,10 @@ class CopyDialog extends Dialog
try
if fs.isDirectorySync(@initialPath)
fs.copySync(@initialPath, newPath)
@onCopy?({initialPath: @initialPath, newPath: newPath})
else
fs.copy @initialPath, newPath, ->
fs.copy @initialPath, newPath, =>
@onCopy?({initialPath: @initialPath, newPath: newPath})
atom.workspace.open newPath,
activatePane: true
initialLine: activeEditor?.getLastCursor().getBufferRow()
Expand Down
73 changes: 48 additions & 25 deletions lib/dialog.coffee
Original file line number Diff line number Diff line change
@@ -1,48 +1,71 @@
{$, TextEditorView, View} = require 'atom-space-pen-views'
{TextEditor, CompositeDisposable, Disposable, Emitter, Range, Point} = require 'atom'
path = require 'path'
{getFullExtension} = require "./helpers"

module.exports =
class Dialog extends View
@content: ({prompt} = {}) ->
@div class: 'tree-view-dialog', =>
@label prompt, class: 'icon', outlet: 'promptText'
@subview 'miniEditor', new TextEditorView(mini: true)
@div class: 'error-message', outlet: 'errorMessage'

initialize: ({initialPath, select, iconClass} = {}) ->
@promptText.addClass(iconClass) if iconClass
class Dialog
constructor: ({initialPath, select, iconClass, prompt} = {}) ->
@emitter = new Emitter()
@disposables = new CompositeDisposable()

@element = document.createElement('div')
@element.classList.add('tree-view-dialog')

@promptText = document.createElement('label')
@promptText.classList.add('icon')
@promptText.classList.add(iconClass) if iconClass
@promptText.textContent = prompt
@element.appendChild(@promptText)

@miniEditor = new TextEditor({mini: true})
blurHandler = =>
@close() if document.hasFocus()
@miniEditor.element.addEventListener('blur', blurHandler)
@disposables.add(new Disposable(=> @miniEditor.element.removeEventListener('blur', blurHandler)))
@disposables.add(@miniEditor.onDidChange => @showError())
@element.appendChild(@miniEditor.element)

@errorMessage = document.createElement('div')
@errorMessage.classList.add('error-message')
@element.appendChild(@errorMessage)

atom.commands.add @element,
'core:confirm': => @onConfirm(@miniEditor.getText())
'core:cancel': => @cancel()
@miniEditor.on 'blur', => @close() if document.hasFocus()
@miniEditor.getModel().onDidChange => @showError()
@miniEditor.getModel().setText(initialPath)

@miniEditor.setText(initialPath)

if select
extension = path.extname(initialPath)
extension = getFullExtension(initialPath)
baseName = path.basename(initialPath)
selectionStart = initialPath.length - baseName.length
if baseName is extension
selectionEnd = initialPath.length
else
selectionEnd = initialPath.length - extension.length
range = [[0, initialPath.length - baseName.length], [0, selectionEnd]]
@miniEditor.getModel().setSelectedBufferRange(range)
@miniEditor.setSelectedBufferRange(Range(Point(0, selectionStart), Point(0, selectionEnd)))

attach: ->
@panel = atom.workspace.addModalPanel(item: this.element)
@miniEditor.focus()
@miniEditor.getModel().scrollToCursorPosition()
@panel = atom.workspace.addModalPanel(item: this)
@miniEditor.element.focus()
@miniEditor.scrollToCursorPosition()

close: ->
panelToDestroy = @panel
panel = @panel
@panel = null
panelToDestroy?.destroy()
atom.workspace.getActivePane().activate()
panel?.destroy()
@emitter.dispose()
@disposables.dispose()
@miniEditor.destroy()
activePane = atom.workspace.getCenter().getActivePane()
activePane.activate() unless activePane.isDestroyed()

cancel: ->
@close()
$('.tree-view').focus()
document.querySelector('.tree-view')?.focus()

showError: (message='') ->
@errorMessage.text(message)
@flashError() if message
@errorMessage.textContent = message
if message
@element.classList.add('error')
window.setTimeout((=> @element.classList.remove('error')), 300)
87 changes: 51 additions & 36 deletions lib/directory-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ Directory = require './directory'
FileView = require './file-view'
{repoForPath} = require './helpers'

class DirectoryView extends HTMLElement
initialize: (@directory) ->
module.exports =
class DirectoryView
constructor: (@directory) ->
@subscriptions = new CompositeDisposable()
@subscriptions.add @directory.onDidDestroy => @subscriptions.dispose()
@subscribeToDirectory()

@classList.add('directory', 'entry', 'list-nested-item', 'collapsed')
@element = document.createElement('li')
@element.setAttribute('is', 'tree-view-directory')
@element.classList.add('directory', 'entry', 'list-nested-item', 'collapsed')

@header = document.createElement('div')
@header.classList.add('header', 'list-item')
Expand All @@ -29,36 +32,51 @@ class DirectoryView extends HTMLElement
else
iconClass = 'icon-file-submodule' if @directory.submodule
@directoryName.classList.add(iconClass)
@directoryName.dataset.name = @directory.name
@directoryName.title = @directory.name
@directoryName.dataset.path = @directory.path

if @directory.squashedName?
@squashedDirectoryName = document.createElement('span')
@squashedDirectoryName.classList.add('squashed-dir')
@squashedDirectoryName.textContent = @directory.squashedName

directoryNameTextNode = document.createTextNode(@directory.name)
if @directory.squashedNames?
@directoryName.dataset.name = @directory.squashedNames.join('')
@directoryName.title = @directory.squashedNames.join('')
squashedDirectoryNameNode = document.createElement('span')
squashedDirectoryNameNode.classList.add('squashed-dir')
squashedDirectoryNameNode.textContent = @directory.squashedNames[0]
@directoryName.appendChild(squashedDirectoryNameNode)
@directoryName.appendChild(document.createTextNode(@directory.squashedNames[1]))
else
@directoryName.dataset.name = @directory.name
@directoryName.title = @directory.name
@directoryName.textContent = @directory.name

@appendChild(@header)
if @squashedDirectoryName?
@directoryName.appendChild(@squashedDirectoryName)
@directoryName.appendChild(directoryNameTextNode)
@element.appendChild(@header)
@header.appendChild(@directoryName)
@appendChild(@entries)
@element.appendChild(@entries)

if @directory.isRoot
@classList.add('project-root')
@element.classList.add('project-root')
@header.classList.add('project-root-header')
else
@draggable = true
@element.draggable = true
@subscriptions.add @directory.onDidStatusChange => @updateStatus()
@updateStatus()

@expand() if @directory.expansionState.isExpanded

@element.collapse = @collapse.bind(this)
@element.expand = @expand.bind(this)
@element.toggleExpansion = @toggleExpansion.bind(this)
@element.reload = @reload.bind(this)
@element.isExpanded = @isExpanded
@element.updateStatus = @updateStatus.bind(this)
@element.isPathEqual = @isPathEqual.bind(this)
@element.getPath = @getPath.bind(this)
@element.directory = @directory
@element.header = @header
@element.entries = @entries
@element.directoryName = @directoryName

updateStatus: ->
@classList.remove('status-ignored', 'status-modified', 'status-added')
@classList.add("status-#{@directory.status}") if @directory.status?
@element.classList.remove('status-ignored', 'status-modified', 'status-added')
@element.classList.add("status-#{@directory.status}") if @directory.status?

subscribeToDirectory: ->
@subscriptions.add @directory.onDidAddEntries (addedEntries) =>
Expand All @@ -71,9 +89,9 @@ class DirectoryView extends HTMLElement

insertionIndex = entry.indexInParentDirectory
if insertionIndex < numberOfEntries
@entries.insertBefore(view, @entries.children[insertionIndex])
@entries.insertBefore(view.element, @entries.children[insertionIndex])
else
@entries.appendChild(view)
@entries.appendChild(view.element)

numberOfEntries++

Expand All @@ -85,16 +103,14 @@ class DirectoryView extends HTMLElement

createViewForEntry: (entry) ->
if entry instanceof Directory
view = new DirectoryElement()
view = new DirectoryView(entry)
else
view = new FileView()
view.initialize(entry)
view = new FileView(entry)

subscription = @directory.onDidRemoveEntries (removedEntries) ->
for removedName, removedEntry of removedEntries when entry is removedEntry
view.remove()
if removedEntries.has(entry)
view.element.remove()
subscription.dispose()
break
@subscriptions.add(subscription)

view
Expand All @@ -108,27 +124,26 @@ class DirectoryView extends HTMLElement
expand: (isRecursive=false) ->
unless @isExpanded
@isExpanded = true
@classList.add('expanded')
@classList.remove('collapsed')
@element.isExpanded = @isExpanded
@element.classList.add('expanded')
@element.classList.remove('collapsed')
@directory.expand()

if isRecursive
for entry in @entries.children when entry instanceof DirectoryView
for entry in @entries.children when entry.classList.contains('directory')
entry.expand(true)

false

collapse: (isRecursive=false) ->
@isExpanded = false
@element.isExpanded = false

if isRecursive
for entry in @entries.children when entry.isExpanded
entry.collapse(true)

@classList.remove('expanded')
@classList.add('collapsed')
@element.classList.remove('expanded')
@element.classList.add('collapsed')
@directory.collapse()
@entries.innerHTML = ''

DirectoryElement = document.registerElement('tree-view-directory', prototype: DirectoryView.prototype, extends: 'li')
module.exports = DirectoryElement
Loading