restore elements on load from firebase (#2269)
This commit is contained in:
parent
46c421ee26
commit
915bda9fd8
@ -2,6 +2,7 @@ import { createIV, getImportedKey } from "./index";
|
||||
import { ExcalidrawElement } from "../element/types";
|
||||
import { getSceneVersion } from "../element";
|
||||
import Portal from "../components/Portal";
|
||||
import { restoreElements } from "./restore";
|
||||
|
||||
let firebasePromise: Promise<typeof import("firebase/app")> | null = null;
|
||||
|
||||
@ -155,6 +156,5 @@ export async function loadFromFirebase(
|
||||
const storedScene = doc.data() as FirebaseStoredScene;
|
||||
const ciphertext = storedScene.ciphertext.toUint8Array();
|
||||
const iv = storedScene.iv.toUint8Array();
|
||||
const plaintext = await decryptElements(roomKey, iv, ciphertext);
|
||||
return plaintext;
|
||||
return restoreElements(await decryptElements(roomKey, iv, ciphertext));
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ const restoreElementWithProperties = <T extends ExcalidrawElement>(
|
||||
// newly added elements
|
||||
version: element.version || 1,
|
||||
versionNonce: element.versionNonce ?? 0,
|
||||
isDeleted: false,
|
||||
isDeleted: element.isDeleted ?? false,
|
||||
id: element.id || randomId(),
|
||||
fillStyle: element.fillStyle || "hachure",
|
||||
strokeWidth: element.strokeWidth || 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user