diff --git a/src/app/editor.coffee b/src/app/editor.coffee index c1516d416..417460a9a 100644 --- a/src/app/editor.coffee +++ b/src/app/editor.coffee @@ -39,6 +39,9 @@ class Editor extends View softTabs: true tabText: ' ' + @deserialize: (viewState) -> + new Editor(viewState) + initialize: ({editSessions, activeEditSessionIndex, buffer, isFocused}) -> requireStylesheet 'editor.css' requireStylesheet 'theme/twilight.css' diff --git a/src/app/root-view.coffee b/src/app/root-view.coffee index 2563e2297..fe8c781ad 100644 --- a/src/app/root-view.coffee +++ b/src/app/root-view.coffee @@ -20,6 +20,9 @@ class RootView extends View @div id: 'root-view', tabindex: -1, => @div id: 'panes', outlet: 'panes' + @deserialize: (viewState) -> + new RootView(viewState) + initialize: ({ pathToOpen, projectPath, panesViewState }) -> @on 'toggle-file-finder', => @toggleFileFinder() @on 'show-console', => window.showConsole() @@ -57,7 +60,7 @@ class RootView extends View when 'Pane' then Pane.deserialize(viewState, this) when 'PaneRow' then PaneRow.deserialize(viewState, this) when 'PaneColumn' then PaneColumn.deserialize(viewState, this) - when 'Editor' then new Editor(viewState) + when 'Editor' then Editor.deserialize(viewState) open: (path) -> @activeEditor().setBuffer(@project.open(path)) diff --git a/src/app/window.coffee b/src/app/window.coffee index 2de2205ba..32c0a9812 100644 --- a/src/app/window.coffee +++ b/src/app/window.coffee @@ -36,8 +36,11 @@ windowAdditions = atom.windowClosed this attachRootView: (pathToOpen) -> - rootViewState = atom.rootViewStates[$windowNumber] or { pathToOpen } - @rootView = new RootView(rootViewState) + rootViewState = atom.rootViewStates[$windowNumber] + @rootView = if rootViewState + RootView.deserialize(rootViewState) + else + new RootView {pathToOpen} $(@rootViewParentSelector).append @rootView saveRootViewState: ->