mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-21 16:08:24 +03:00
Collapse selected path with left arrow
This commit is contained in:
parent
1a8bba4d70
commit
a42a82c8c0
@ -16,3 +16,6 @@
|
|||||||
'.command-panel':
|
'.command-panel':
|
||||||
'ctrl-{': 'command-panel:collapse-all'
|
'ctrl-{': 'command-panel:collapse-all'
|
||||||
'ctrl-}': 'command-panel:expand-all'
|
'ctrl-}': 'command-panel:expand-all'
|
||||||
|
|
||||||
|
'.command-panel .preview-list':
|
||||||
|
'left': 'command-panel:collapse-result'
|
||||||
|
@ -25,6 +25,13 @@ class PreviewList extends ScrollView
|
|||||||
@on 'mousedown', 'li.path', @onPathSelected
|
@on 'mousedown', 'li.path', @onPathSelected
|
||||||
@command 'command-panel:collapse-all', => @collapseAllPaths()
|
@command 'command-panel:collapse-all', => @collapseAllPaths()
|
||||||
@command 'command-panel:expand-all', => @expandAllPaths()
|
@command 'command-panel:expand-all', => @expandAllPaths()
|
||||||
|
@command 'command-panel:collapse-result', @collapseSelectedPath
|
||||||
|
|
||||||
|
collapseSelectedPath: (event) =>
|
||||||
|
e = $('.selected').closest('.path')
|
||||||
|
return if e.hasClass 'is-collapsed'
|
||||||
|
e.children('ul.matches').hide 100, (e) ->
|
||||||
|
$(this).closest('li.path').add 'is-collapsed'
|
||||||
|
|
||||||
onPathSelected: (event) =>
|
onPathSelected: (event) =>
|
||||||
e = $(event.target)
|
e = $(event.target)
|
||||||
|
@ -478,3 +478,10 @@ describe "CommandPanel", ->
|
|||||||
|
|
||||||
previewList.find('li.path:first-child').mousedown()
|
previewList.find('li.path:first-child').mousedown()
|
||||||
expect(previewList.find('li.path:first-child ul.matches')).toBeVisible()
|
expect(previewList.find('li.path:first-child ul.matches')).toBeVisible()
|
||||||
|
|
||||||
|
describe "when command-panel:collapse-result is triggered", ->
|
||||||
|
it "collapses the path of the selected operation", ->
|
||||||
|
rootView.attachToDom()
|
||||||
|
expect(previewList.find('li.path:first-child ul.matches')).toBeVisible()
|
||||||
|
previewList.trigger 'command-panel:collapse-result'
|
||||||
|
expect(previewList.find('li.path:first-child ul.matches')).toBeHidden()
|
||||||
|
Loading…
Reference in New Issue
Block a user