group localestorage related code into the extension

This commit is contained in:
JFH
2022-02-01 23:46:31 +01:00
parent de0ee4e59c
commit d0b6fcaebf
2 changed files with 20 additions and 18 deletions

View File

@@ -340,21 +340,6 @@ export default class ConfigObj {
return
}
// LOAD CONTENT
if (this.editor.storage && // Cookies do not have enough available memory to hold large documents
(this.curConfig.forceStorage ||
(!this.curConfig.noStorageOnLoad &&
(/(?:^|;\s*)svgeditstore=prefsAndContent/).test(document.cookie))
)
) {
const name = 'svgedit-' + this.curConfig.canvasName
const cached = this.editor.storage.getItem(name)
if (cached) {
this.editor.loadFromString(cached)
this.editor.topPanel.updateTitle(this.editor.storage.getItem(`title-${name}`) ?? 'untitled.svg')
}
}
// LOAD PREFS
Object.keys(this.defaultPrefs).forEach((key) => {
const storeKey = 'svg-edit-' + key