diff --git a/src/pages/save-local.jsx b/src/pages/save-local.jsx index 96b594e..a1d7f2c 100644 --- a/src/pages/save-local.jsx +++ b/src/pages/save-local.jsx @@ -18,17 +18,7 @@ import { Navigate } from "react-router-dom"; import { timestamp2text } from "../components/utils"; -function uuidv4() { - return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) => - ( - c ^ - (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (c / 4))) - ).toString(16) - ); -} - function Save() { - let id = uuidv4(); let name = localStorage.getItem("NoteName"); let text = localStorage.getItem("NoteText"); let pubTime = Number(localStorage.getItem("NotePubTime")); @@ -36,6 +26,7 @@ function Save() { if (!name || !text) return ; let notesObj = localStorage.getObj("Notes"); + let id = Object.keys(notesObj).length; let time = Date.now();