You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
871 B
43 lines
871 B
<script lang="ts">
|
|
|
|
import {type Cat, toCatID} from "@/vcen/lib";
|
|
|
|
import CatalogEditor from "@/vcen-edit/comps/CatalogEditor.svelte";
|
|
|
|
const STORAGE_KEY = 'vcen-editor-cat'
|
|
|
|
function loadCat(): Cat {
|
|
try {
|
|
const stored = localStorage.getItem(STORAGE_KEY)
|
|
if (stored) return JSON.parse(stored)
|
|
} catch {}
|
|
return {
|
|
id: toCatID('test'),
|
|
name: 'Nuevo',
|
|
optCategories: [],
|
|
opts: [],
|
|
atts: [],
|
|
objs: [],
|
|
}
|
|
}
|
|
|
|
function saveCat(cat: Cat) {
|
|
try {
|
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(cat))
|
|
} catch {}
|
|
}
|
|
|
|
const cat = loadCat()
|
|
|
|
</script>
|
|
|
|
|
|
<div class="h-full">
|
|
<CatalogEditor {cat} onsave={saveCat} />
|
|
</div>
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|