Fix editor regressions and add Blender scene and animated material import
This commit is contained in:
@@ -7,10 +7,10 @@ function db(): Promise<IDBDatabase> {
|
||||
req.onerror = () => reject(req.error);
|
||||
});
|
||||
}
|
||||
export async function loadDraft() {
|
||||
export async function loadDraft(key = "active") {
|
||||
const d = await db();
|
||||
return new Promise<Project | null>((resolve, reject) => {
|
||||
const r = d.transaction("projects").objectStore("projects").get("active");
|
||||
const r = d.transaction("projects").objectStore("projects").get(key);
|
||||
r.onsuccess = () => {
|
||||
d.close();
|
||||
if (r.result) {
|
||||
@@ -25,11 +25,11 @@ export async function loadDraft() {
|
||||
r.onerror = () => reject(r.error);
|
||||
});
|
||||
}
|
||||
export async function saveDraft(p: Project) {
|
||||
export async function saveDraft(p: Project, key = "active") {
|
||||
const d = await db();
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
const tx = d.transaction("projects", "readwrite");
|
||||
tx.objectStore("projects").put(p, "active");
|
||||
tx.objectStore("projects").put(p, key);
|
||||
tx.oncomplete = () => {
|
||||
d.close();
|
||||
resolve();
|
||||
|
||||
Reference in New Issue
Block a user