feat: remember last edited scene path in editor via localStorage
This commit is contained in:
@@ -79,7 +79,23 @@ async function loadDemo() {
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => loadDemo())
|
||||
async function restoreOrLoad() {
|
||||
const lastSource = localStorage.getItem('editor_last_source')
|
||||
if (lastSource) {
|
||||
try {
|
||||
loading.value = true
|
||||
const resp = await fetch(lastSource)
|
||||
if (resp.ok) {
|
||||
store.loadJSON(await resp.json())
|
||||
store.setSourcePath(lastSource)
|
||||
return
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
await loadDemo()
|
||||
}
|
||||
|
||||
onMounted(() => restoreOrLoad())
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user