Revert "Save scene in URL (#220)" (#234)

This reverts commit db973c61e8.
This commit is contained in:
Timur Khazamov 2020-01-07 20:18:20 +05:00 committed by Christopher Chedeau
parent 829a65b8cb
commit ae982e9298
3 changed files with 3 additions and 40 deletions

View file

@ -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);
}

View file

@ -12,9 +12,7 @@ export {
loadFromJSON,
saveAsJSON,
restoreFromLocalStorage,
saveToLocalStorage,
restoreFromURL,
saveToURL
saveToLocalStorage
} from "./data";
export { hasBackground, hasStroke, getElementAtPosition } from "./comparisons";
export { createScene } from "./createScene";