mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
This reverts commit db973c61e8
.
This commit is contained in:
parent
829a65b8cb
commit
ae982e9298
3 changed files with 3 additions and 40 deletions
|
@ -174,22 +174,3 @@ export function saveToLocalStorage(
|
|||
localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(elements));
|
||||
localStorage.setItem(LOCAL_STORAGE_KEY_STATE, JSON.stringify(state));
|
||||
}
|
||||
|
||||
export function restoreFromURL(elements: ExcalidrawElement[]) {
|
||||
try {
|
||||
const [savedElements, savedState] = document.location.hash
|
||||
.slice(1)
|
||||
.split(":")
|
||||
.map(atob);
|
||||
return restore(elements, savedElements, savedState);
|
||||
} catch (ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function saveToURL(elements: ExcalidrawElement[], state: AppState) {
|
||||
const hash = [JSON.stringify(elements), JSON.stringify(state)]
|
||||
.map(btoa)
|
||||
.join(":");
|
||||
document.location.replace("#" + hash);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,7 @@ export {
|
|||
loadFromJSON,
|
||||
saveAsJSON,
|
||||
restoreFromLocalStorage,
|
||||
saveToLocalStorage,
|
||||
restoreFromURL,
|
||||
saveToURL
|
||||
saveToLocalStorage
|
||||
} from "./data";
|
||||
export { hasBackground, hasStroke, getElementAtPosition } from "./comparisons";
|
||||
export { createScene } from "./createScene";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue