mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Make Atom SpacePen view's default to empty object (where needed)
This commit is contained in:
@@ -13,7 +13,7 @@ class Cursor extends View
|
||||
editor: null
|
||||
wordRegex: /(\w+)|([^\w\s]+)/g
|
||||
|
||||
initialize: ({editor, screenPosition}) ->
|
||||
initialize: ({editor, screenPosition} = {}) ->
|
||||
@editor = editor
|
||||
@anchor = new Anchor(@editor, screenPosition)
|
||||
@selection = @editor.compositeSelection.addSelectionForCursor(this)
|
||||
|
||||
@@ -24,7 +24,7 @@ class Editor extends View
|
||||
@div class: 'vertical-scrollbar', outlet: 'verticalScrollbar', =>
|
||||
@div outlet: 'verticalScrollbarContent'
|
||||
|
||||
@classes: ({mini}) ->
|
||||
@classes: ({mini} = {}) ->
|
||||
classes = ['editor']
|
||||
classes.push 'mini' if mini
|
||||
classes.join(' ')
|
||||
@@ -57,7 +57,7 @@ class Editor extends View
|
||||
|
||||
new Editor(viewState)
|
||||
|
||||
initialize: ({editSessions, activeEditSessionIndex, buffer, isFocused, @mini}) ->
|
||||
initialize: ({editSessions, activeEditSessionIndex, buffer, isFocused, @mini} = {}) ->
|
||||
requireStylesheet 'editor.css'
|
||||
requireStylesheet 'theme/twilight.css'
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class RootView extends View
|
||||
@div id: 'panes', outlet: 'panes'
|
||||
|
||||
@deserialize: ({ projectPath, panesViewState, extensionStates }) ->
|
||||
rootView = new RootView(pathToOpen: projectPath)
|
||||
rootView = new RootView(projectPath)
|
||||
rootView.setRootPane(rootView.deserializeView(panesViewState)) if panesViewState
|
||||
rootView.extensionStates = extensionStates if extensionStates
|
||||
rootView
|
||||
@@ -30,7 +30,7 @@ class RootView extends View
|
||||
extensionStates: null
|
||||
fontSize: 18
|
||||
|
||||
initialize: ({ pathToOpen }) ->
|
||||
initialize: (pathToOpen) ->
|
||||
@extensions = {}
|
||||
@extensionStates = {}
|
||||
@project = new Project(pathToOpen)
|
||||
|
||||
@@ -14,7 +14,7 @@ class Selection extends View
|
||||
retainSelection: null
|
||||
regions: null
|
||||
|
||||
initialize: ({@editor, @cursor}) ->
|
||||
initialize: ({@editor, @cursor} = {}) ->
|
||||
@regions = []
|
||||
|
||||
handleBufferChange: (e) ->
|
||||
|
||||
@@ -42,7 +42,7 @@ windowAdditions =
|
||||
if rootViewState
|
||||
@rootView = RootView.deserialize(rootViewState)
|
||||
else
|
||||
@rootView = new RootView(pathToOpen: pathToOpen)
|
||||
@rootView = new RootView(pathToOpen)
|
||||
@rootView.open() unless pathToOpen
|
||||
|
||||
$(@rootViewParentSelector).append @rootView
|
||||
|
||||
@@ -5,12 +5,12 @@ $ = require 'jquery'
|
||||
|
||||
module.exports =
|
||||
class Dialog extends View
|
||||
@content: ({prompt}) ->
|
||||
@content: ({prompt} = {}) ->
|
||||
@div class: 'tree-view-dialog', =>
|
||||
@div prompt, outlet: 'prompt'
|
||||
@subview 'miniEditor', new Editor(mini: true)
|
||||
|
||||
initialize: ({path, @onConfirm, select}) ->
|
||||
initialize: ({path, @onConfirm, select} = {}) ->
|
||||
@miniEditor.focus()
|
||||
@on 'tree-view:confirm', => @confirm()
|
||||
@on 'tree-view:cancel', => @cancel()
|
||||
|
||||
@@ -5,7 +5,7 @@ $ = require 'jquery'
|
||||
|
||||
module.exports =
|
||||
class DirectoryView extends View
|
||||
@content: ({directory, isExpanded}) ->
|
||||
@content: ({directory, isExpanded} = {}) ->
|
||||
@li class: 'directory entry', =>
|
||||
@div outlet: 'header', class: 'header', =>
|
||||
@span '▸', class: 'disclosure-arrow', outlet: 'disclosureArrow'
|
||||
@@ -15,7 +15,7 @@ class DirectoryView extends View
|
||||
entries: null
|
||||
header: null
|
||||
|
||||
initialize: ({@directory, isExpanded}) ->
|
||||
initialize: ({@directory, isExpanded} = {}) ->
|
||||
@expand() if isExpanded
|
||||
@disclosureArrow.on 'click', => @toggleExpansion()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user