mirror of
https://github.com/atom/atom.git
synced 2026-02-16 17:45:24 -05:00
Rename PaneAxis to PaneAxisView
This commit is contained in:
@@ -1,34 +0,0 @@
|
||||
{View} = require './space-pen-extensions'
|
||||
PaneView = null
|
||||
|
||||
### Internal ###
|
||||
module.exports =
|
||||
class PaneAxis extends View
|
||||
initialize: (@model) ->
|
||||
@onChildAdded(child) for child in @model.children
|
||||
@subscribe @model.children, 'changed', @onChildrenChanged
|
||||
|
||||
viewForModel: (model) ->
|
||||
viewClass = model.getViewClass()
|
||||
model._view ?= new viewClass(model)
|
||||
|
||||
onChildrenChanged: ({index, removedValues, insertedValues}) =>
|
||||
focusedElement = document.activeElement if @hasFocus()
|
||||
@onChildRemoved(child, index) for child in removedValues
|
||||
@onChildAdded(child, index + i) for child, i in insertedValues
|
||||
focusedElement?.focus() if document.activeElement is document.body
|
||||
|
||||
onChildAdded: (child, index) =>
|
||||
view = @viewForModel(child)
|
||||
@insertAt(index, view)
|
||||
|
||||
onChildRemoved: (child) =>
|
||||
view = @viewForModel(child)
|
||||
view.detach()
|
||||
PaneView ?= require './pane-view'
|
||||
|
||||
if view instanceof PaneView and view.model.isDestroyed()
|
||||
@getContainer()?.trigger 'pane:removed', [view]
|
||||
|
||||
getContainer: ->
|
||||
@closest('.panes').view()
|
||||
Reference in New Issue
Block a user