mirror of
https://github.com/atom/atom.git
synced 2026-02-05 12:15:07 -05:00
Extend AtomPackage directly in packages index.coffee
This commit is contained in:
@@ -1 +1,8 @@
|
||||
module.exports = require 'command-panel/src/command-panel'
|
||||
AtomPackage = require 'atom-package'
|
||||
CommandPanelView = require './src/command-panel-view'
|
||||
|
||||
module.exports =
|
||||
class CommandPanel extends AtomPackage
|
||||
activate: (rootView, state) -> CommandPanelView.activate(rootView, state)
|
||||
deactivate: -> CommandPanelView.deactivate()
|
||||
serialize: -> CommandPanelView.serialize()
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
RootView = require 'root-view'
|
||||
CommandPanel = require 'command-panel'
|
||||
CommandPanelView = require 'command-panel/src/command-panel-view'
|
||||
_ = require 'underscore'
|
||||
|
||||
describe "CommandPanel", ->
|
||||
[rootView, editor, buffer, commandPanel, project] = []
|
||||
[rootView, editor, buffer, commandPanel, project, CommandPanel] = []
|
||||
|
||||
beforeEach ->
|
||||
rootView = new RootView
|
||||
@@ -12,8 +12,8 @@ describe "CommandPanel", ->
|
||||
project = rootView.project
|
||||
editor = rootView.getActiveEditor()
|
||||
buffer = editor.activeEditSession.buffer
|
||||
atom.loadPackage('command-panel')
|
||||
commandPanel = CommandPanel.instance
|
||||
CommandPanel = atom.loadPackage('command-panel')
|
||||
commandPanel = CommandPanelView.instance
|
||||
commandPanel.history = []
|
||||
commandPanel.historyIndex = 0
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ Editor = require 'editor'
|
||||
_ = require 'underscore'
|
||||
|
||||
module.exports =
|
||||
class CommandPanel extends View
|
||||
class CommandPanelView extends View
|
||||
@activate: (rootView, state) ->
|
||||
if state?
|
||||
@instance = CommandPanel.deserialize(state, rootView)
|
||||
@instance = @deserialize(state, rootView)
|
||||
else
|
||||
@instance = new CommandPanel(rootView)
|
||||
@instance = new CommandPanelView(rootView)
|
||||
|
||||
@deactivate: ->
|
||||
@instance.destroy()
|
||||
@@ -26,7 +26,7 @@ class CommandPanel extends View
|
||||
history: @instance.history[-@instance.maxSerializedHistorySize..]
|
||||
|
||||
@deserialize: (state, rootView) ->
|
||||
commandPanel = new CommandPanel(rootView, state.history)
|
||||
commandPanel = new CommandPanelView(rootView, state.history)
|
||||
commandPanel.attach(state.text, focus: false) if state.visible
|
||||
commandPanel.miniEditor.focus() if state.miniEditorFocused
|
||||
commandPanel
|
||||
@@ -93,6 +93,7 @@ class CommandPanel extends View
|
||||
@miniEditor.focus()
|
||||
|
||||
attach: (text='', options={}) ->
|
||||
console.trace 'attached', @rootView
|
||||
@errorMessages.hide()
|
||||
|
||||
focus = options.focus ? true
|
||||
Reference in New Issue
Block a user