mirror of
https://github.com/atom/atom.git
synced 2026-02-09 06:05:11 -05:00
Upgrade to SpacePen 3b85ccfb0ec43, which replace 'attach' events with 'afterAttach' hooks
This commit is contained in:
@@ -17,9 +17,11 @@ class Cursor extends View
|
||||
@editor = editor
|
||||
@anchor = new Anchor(@editor, screenPosition)
|
||||
@selection = @editor.compositeSelection.addSelectionForCursor(this)
|
||||
@one 'attach', =>
|
||||
@updateAppearance()
|
||||
@editor.syncCursorAnimations()
|
||||
|
||||
afterAttach: (onDom) ->
|
||||
return unless onDom
|
||||
@updateAppearance()
|
||||
@editor.syncCursorAnimations()
|
||||
|
||||
handleBufferChange: (e) ->
|
||||
@anchor.handleBufferChange(e)
|
||||
|
||||
@@ -208,14 +208,15 @@ class Editor extends View
|
||||
else
|
||||
@gutter.addClass('drop-shadow')
|
||||
|
||||
@on 'attach', (e) =>
|
||||
return if @attached
|
||||
@attached = true
|
||||
@calculateDimensions()
|
||||
@hiddenInput.width(@charWidth)
|
||||
@setMaxLineLength() if @softWrap
|
||||
@focus() if @isFocused
|
||||
@trigger 'editor-open', [this]
|
||||
|
||||
afterAttach: (onDom) ->
|
||||
return if @attached or not onDom
|
||||
@attached = true
|
||||
@calculateDimensions()
|
||||
@hiddenInput.width(@charWidth)
|
||||
@setMaxLineLength() if @softWrap
|
||||
@focus() if @isFocused
|
||||
@trigger 'editor-open', [this]
|
||||
|
||||
rootView: ->
|
||||
@parents('#root-view').view()
|
||||
|
||||
@@ -26,7 +26,6 @@ class RootView extends View
|
||||
initialize: ({ pathToOpen, projectPath, panesViewState }) ->
|
||||
@on 'toggle-file-finder', => @toggleFileFinder()
|
||||
@on 'show-console', => window.showConsole()
|
||||
@one 'attach', => @focus()
|
||||
@on 'focus', (e) =>
|
||||
if @activeEditor()
|
||||
@activeEditor().focus()
|
||||
@@ -50,6 +49,9 @@ class RootView extends View
|
||||
|
||||
@deserializePanes(panesViewState) if panesViewState
|
||||
|
||||
afterAttach: (onDom) ->
|
||||
@focus() if onDom
|
||||
|
||||
serialize: ->
|
||||
projectPath: @project?.path
|
||||
panesViewState: @serializePanes()
|
||||
|
||||
Reference in New Issue
Block a user