mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
When the select list is cancelled or its editor loses focus, it detaches itself
This commit is contained in:
@@ -14,14 +14,16 @@ class SelectList extends View
|
||||
|
||||
maxItems: Infinity
|
||||
filteredArray: null
|
||||
cancelling: false
|
||||
|
||||
initialize: ->
|
||||
requireStylesheet 'select-list.css'
|
||||
@miniEditor.getBuffer().on 'change', => @populateList()
|
||||
@miniEditor.on 'focusout', => @cancel() unless @cancelling
|
||||
@on 'move-up', => @selectPreviousItem()
|
||||
@on 'move-down', => @selectNextItem()
|
||||
@on 'core:confirm', => @confirmSelection()
|
||||
@on 'core:cancel', => @cancelled()
|
||||
@on 'core:cancel', => @cancel()
|
||||
|
||||
setArray: (@array) ->
|
||||
@populateList()
|
||||
@@ -73,3 +75,9 @@ class SelectList extends View
|
||||
element = @getSelectedItem().data('select-list-element')
|
||||
@confirmed(element) if element?
|
||||
|
||||
cancel: ->
|
||||
@cancelling = true
|
||||
@cancelled()
|
||||
@detach()
|
||||
@cancelling = false
|
||||
|
||||
|
||||
Reference in New Issue
Block a user