Handle 'focus' events in ReactEditorView and transfer to the component

Fixes #3234
This commit is contained in:
Nathan Sobo
2014-08-12 16:56:16 -06:00
parent 64c25f17df
commit 2911b395ee

View File

@@ -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()