mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Handle 'focus' events in ReactEditorView and transfer to the component
Fixes #3234
This commit is contained in:
@@ -10,6 +10,7 @@ class ReactEditorView extends View
|
||||
@content: (params) ->
|
||||
attributes = params.attributes ? {}
|
||||
attributes.class = 'editor react editor-colors'
|
||||
attributes.tabIndex = -1
|
||||
@div attributes
|
||||
|
||||
focusOnAttach: false
|
||||
@@ -55,6 +56,11 @@ class ReactEditorView extends View
|
||||
lines.addClass(klass)
|
||||
lines.length > 0
|
||||
|
||||
@on 'focus', =>
|
||||
if @component?
|
||||
@component.onFocus()
|
||||
else
|
||||
@focusOnAttach = true
|
||||
|
||||
getEditor: -> @editor
|
||||
|
||||
@@ -143,12 +149,6 @@ class ReactEditorView extends View
|
||||
getPane: ->
|
||||
@parent('.item-views').parents('.pane').view()
|
||||
|
||||
focus: ->
|
||||
if @component?
|
||||
@component.onFocus()
|
||||
else
|
||||
@focusOnAttach = true
|
||||
|
||||
hide: ->
|
||||
super
|
||||
@pollComponentDOM()
|
||||
|
||||
Reference in New Issue
Block a user