mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Serialize site across window loads
This prevents issues with the site counter resetting to 1 on each load causing duplicate array and marker ids to be generated. Closes #729
This commit is contained in:
@@ -228,11 +228,19 @@ window.atom =
|
||||
catch error
|
||||
console.warn "Error parsing window state: #{windowStatePath}", error.stack, error
|
||||
|
||||
windowState ?= {}
|
||||
site.deserializeDocument(windowState) ? site.createDocument({})
|
||||
{site, document} = windowState ? {}
|
||||
if site? and document?
|
||||
window.site = telepath.Site.deserialize(site)
|
||||
window.site.deserializeDocument(document)
|
||||
else
|
||||
window.site = new telepath.Site(1)
|
||||
window.site.createDocument({})
|
||||
|
||||
saveWindowState: ->
|
||||
windowStateJson = JSON.stringify(@getWindowState().serialize(), null, 2)
|
||||
windowState =
|
||||
site: site.serialize()
|
||||
document: @getWindowState().serialize()
|
||||
windowStateJson = JSON.stringify(windowState, null, 2)
|
||||
if windowStatePath = @getWindowStatePath()
|
||||
fsUtils.writeSync(windowStatePath, "#{windowStateJson}\n")
|
||||
else
|
||||
|
||||
@@ -21,7 +21,6 @@ windowEventHandler = null
|
||||
|
||||
# This method is called in any window needing a general environment, including specs
|
||||
window.setUpEnvironment = (windowMode) ->
|
||||
window.site = new telepath.Site(1)
|
||||
atom.windowMode = windowMode
|
||||
window.resourcePath = remote.getCurrentWindow().loadSettings.resourcePath
|
||||
|
||||
|
||||
2
vendor/telepath
vendored
2
vendor/telepath
vendored
Submodule vendor/telepath updated: 064b0df33a...2638740aa0
Reference in New Issue
Block a user