mirror of
https://github.com/atom/atom.git
synced 2026-02-08 21:55:05 -05:00
Remove bindKey from views. Make FileFinder use atom.bindKeys
This commit is contained in:
@@ -10,7 +10,7 @@ class App
|
||||
constructor: ->
|
||||
@native = new Native
|
||||
@globalKeymap = new GlobalKeymap
|
||||
$(document).on 'keydown', (e) => console.log e; @globalKeymap.handleKeyEvent(e)
|
||||
$(document).on 'keydown', (e) => @globalKeymap.handleKeyEvent(e)
|
||||
|
||||
bindKeys: (selector, bindings) ->
|
||||
@globalKeymap.bindKeys(selector, bindings)
|
||||
|
||||
@@ -5,8 +5,8 @@ stringScore = require 'stringscore'
|
||||
module.exports =
|
||||
class FileFinder extends Template
|
||||
content: ->
|
||||
@link rel: 'stylesheet', href: "#{require.resolve('file-finder.css')}?#{(new Date).getTime()}"
|
||||
@div class: 'file-finder', =>
|
||||
@link rel: 'stylesheet', href: "#{require.resolve('file-finder.css')}?#{(new Date).getTime()}"
|
||||
@ol outlet: 'urlList'
|
||||
@input outlet: 'input', input: 'populateUrlList'
|
||||
|
||||
@@ -18,9 +18,14 @@ class FileFinder extends Template
|
||||
@maxResults = 10
|
||||
|
||||
@populateUrlList()
|
||||
@bindKey 'up', 'moveUp'
|
||||
@bindKey 'down', 'moveDown'
|
||||
@bindKey 'enter', 'select'
|
||||
atom.bindKeys ".file-finder",
|
||||
'up': 'move-up'
|
||||
'down': 'move-down'
|
||||
'enter': 'select'
|
||||
|
||||
@on 'move-up', => @moveUp()
|
||||
@on 'move-down', => @moveDown()
|
||||
@on 'select', => @select()
|
||||
|
||||
populateUrlList: ->
|
||||
@urlList.empty()
|
||||
|
||||
@@ -51,12 +51,3 @@ class Template
|
||||
$.fn.view = ->
|
||||
this.data('view')
|
||||
|
||||
$.fn.bindKey = (pattern, action) ->
|
||||
@on 'keydown', (event) =>
|
||||
bindingSet = new (require('binding-set'))("*", {})
|
||||
if bindingSet.eventMatchesPattern(event, pattern)
|
||||
if _.isString(action)
|
||||
this.view()[action]()
|
||||
else
|
||||
action()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user