mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
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:
parent
7c0239e693
commit
d9ad7c039b
6 changed files with 272 additions and 1 deletions
|
@ -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
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue