Always use global rootView object

This removes the last few places where rootView was
looked up via jQuery selector and instead just uses
the rootView property available on the window.
This commit is contained in:
Kevin Sawicki 2013-02-15 09:15:45 -08:00
parent 092e5214d0
commit 2910f7798a
5 changed files with 8 additions and 15 deletions

View File

@ -57,7 +57,7 @@ class Editor extends View
newSelections: null
redrawOnReattach: false
@deserialize: (state, rootView) ->
@deserialize: (state) ->
editor = new Editor(mini: state.mini, deserializing: true)
editSessions = state.editSessions.map (state) -> EditSession.deserialize(state, rootView.project)
editor.pushEditSession(editSession) for editSession in editSessions
@ -101,7 +101,7 @@ class Editor extends View
isFocused: @isFocused
copy: ->
Editor.deserialize(@serialize(), @rootView())
Editor.deserialize(@serialize(), rootView)
bindKeys: ->
editorBindings =
@ -356,7 +356,7 @@ class Editor extends View
false
@hiddenInput.on 'focus', =>
@rootView()?.editorFocused(this)
rootView?.editorFocused(this)
@isFocused = true
@addClass 'is-focused'
@ -483,7 +483,7 @@ class Editor extends View
return unless @closedEditSessions.length > 0
{path, index} = @closedEditSessions.pop()
@rootView().open(path)
rootView.open(path)
activeIndex = @getActiveEditSessionIndex()
@moveEditSessionToIndex(activeIndex, index) if index < activeIndex
@ -782,9 +782,6 @@ class Editor extends View
pane: ->
@parent('.pane').view()
rootView: ->
@parents('#root-view').view()
promptToSaveDirtySession: (session, callback) ->
path = session.getPath()
filename = if path then fs.base(path) else "untitled buffer"

View File

@ -45,5 +45,5 @@ class GrammarView extends SelectList
attach: ->
super
@editor.rootView()?.append(this)
rootView.append(this)
@miniEditor.focus()

View File

@ -43,7 +43,7 @@ class Pane extends View
pane = new Pane(view)
this[side](pane)
@rootView().adjustPaneDimensions()
rootView.adjustPaneDimensions()
view.focus?()
pane
@ -51,7 +51,6 @@ class Pane extends View
return super if keepData
# find parent elements before removing from dom
parentAxis = @parent('.row, .column')
rootView = @rootView()
super
if parentAxis.children().length == 1
sibling = parentAxis.children().detach()
@ -62,6 +61,3 @@ class Pane extends View
switch axis
when 'row' then new PaneRow
when 'column' then new PaneColumn
rootView: ->
@parents('#root-view').view()

View File

@ -73,7 +73,7 @@ class AutocompleteView extends SelectList
@editor.abort()
@editor.setSelectedBufferRange(@originalSelectionBufferRange)
@editor.rootView()?.focus() if @miniEditor.isFocused
rootView.focus() if @miniEditor.isFocused
attach: ->
@editor.transact()

View File

@ -11,7 +11,7 @@ find: (editor) ->
word = editor.getTextInRange(editor.getCursor().getCurrentWordBufferRange())
return [] unless word.length > 0
tagsFile = @getTagsFile(editor.rootView().project)
tagsFile = @getTagsFile(rootView.project)
return [] unless tagsFile
$tags.find(tagsFile, word) or []