Merge pull request #14134 from atom/fb-mdt-dont-store-default-locations

Don't store default locations
This commit is contained in:
Nathan Sobo
2017-04-05 10:59:01 -06:00
committed by GitHub
4 changed files with 57 additions and 8 deletions

View File

@@ -77,6 +77,21 @@ class StateStore {
})
}
delete (key) {
return new Promise((resolve, reject) => {
this.dbPromise.then((db) => {
if (db == null) return resolve()
var request = db.transaction(['states'], 'readwrite')
.objectStore('states')
.delete(key)
request.onsuccess = resolve
request.onerror = reject
})
})
}
clear () {
return this.dbPromise.then((db) => {
if (!db) return

View File

@@ -301,7 +301,17 @@ module.exports = class Workspace extends Model {
if (typeof item.getURI === 'function') {
const uri = item.getURI()
if (uri != null) {
this.itemLocationStore.save(item.getURI(), paneContainer.getLocation())
const location = paneContainer.getLocation()
let defaultLocation
if (typeof item.getDefaultLocation === 'function') {
defaultLocation = item.getDefaultLocation()
}
defaultLocation = defaultLocation || 'center'
if (location === defaultLocation) {
this.itemLocationStore.delete(item.getURI())
} else {
this.itemLocationStore.save(item.getURI(), location)
}
}
}
})