feat: export scene to e+ on workspace creation/redemption (#8514)

Co-authored-by: dwelle <5153846+dwelle@users.noreply.github.com>
This commit is contained in:
Barnabás Molnár 2024-11-04 23:35:45 +01:00 committed by GitHub
parent 7c0239e693
commit d9ad7c039b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 272 additions and 1 deletions

View file

@ -65,6 +65,20 @@ export const base64ToArrayBuffer = (base64: string): ArrayBuffer => {
return byteStringToArrayBuffer(atob(base64));
};
// -----------------------------------------------------------------------------
// base64url
// -----------------------------------------------------------------------------
export const base64urlToString = (str: string) => {
return window.atob(
// normalize base64URL to base64
str
.replace(/-/g, "+")
.replace(/_/g, "/")
.padEnd(str.length + ((4 - (str.length % 4)) % 4), "="),
);
};
// -----------------------------------------------------------------------------
// text encoding
// -----------------------------------------------------------------------------

View file

@ -50,6 +50,7 @@ export class WorkerUrlNotDefinedError extends Error {
this.code = code;
}
}
export class WorkerInTheMainChunkError extends Error {
public code;
constructor(
@ -61,3 +62,14 @@ export class WorkerInTheMainChunkError extends Error {
this.code = code;
}
}
/**
* Use this for generic, handled errors, so you can check against them
* and rethrow if needed
*/
export class ExcalidrawError extends Error {
constructor(message: string) {
super(message);
this.name = "ExcalidrawError";
}
}