mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Focus react editor on attachment if it had focus previously
This commit is contained in:
@@ -6,6 +6,8 @@ module.exports =
|
||||
class ReactEditorView extends View
|
||||
@content: -> @div class: 'editor react-wrapper'
|
||||
|
||||
focusOnAttach: false
|
||||
|
||||
constructor: (@editor) ->
|
||||
super
|
||||
|
||||
@@ -32,6 +34,8 @@ class ReactEditorView extends View
|
||||
lines.addClass(klass)
|
||||
lines.length > 0
|
||||
|
||||
@focus() if @focusOnAttach
|
||||
|
||||
@trigger 'editor:attached', [this]
|
||||
|
||||
pixelPositionForBufferPosition: (bufferPosition) ->
|
||||
@@ -52,4 +56,7 @@ class ReactEditorView extends View
|
||||
@closest('.pane').view()
|
||||
|
||||
focus: ->
|
||||
@component?.onFocus()
|
||||
if @component?
|
||||
@component.onFocus()
|
||||
else
|
||||
@focusOnAttach = true
|
||||
|
||||
Reference in New Issue
Block a user