mirror of
https://github.com/artegoser/AnoPaper.git
synced 2024-11-22 03:46:22 +03:00
fix: save edited note
This commit is contained in:
parent
3f705bf8c4
commit
6d17fca352
1 changed files with 9 additions and 7 deletions
|
@ -53,16 +53,16 @@ function NotePage() {
|
||||||
edit ? (
|
edit ? (
|
||||||
<>
|
<>
|
||||||
<NoteNameInput
|
<NoteNameInput
|
||||||
value={note.name}
|
value={name}
|
||||||
onChange={(e) => setName(e.target.value)}
|
onChange={(e) => setName(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<NoteTextArea
|
<NoteTextArea
|
||||||
value={note.text}
|
value={text}
|
||||||
onChange={(e) => setText(e.target.value)}
|
onChange={(e) => setText(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-2 justify-items-center w-full">
|
<div className="grid grid-cols-1 lg:grid-cols-2 justify-items-center w-full">
|
||||||
<NotesAdditionalSettings
|
<NotesAdditionalSettings
|
||||||
noteText={note.text}
|
noteText={text}
|
||||||
onClick={(text) => {
|
onClick={(text) => {
|
||||||
setText(text);
|
setText(text);
|
||||||
}}
|
}}
|
||||||
|
@ -80,13 +80,15 @@ function NotePage() {
|
||||||
<div className="justify-self-center lg:justify-self-end">
|
<div className="justify-self-center lg:justify-self-end">
|
||||||
<ButtonWithIcon
|
<ButtonWithIcon
|
||||||
className="mt-4"
|
className="mt-4"
|
||||||
text={locals.Edit}
|
text={edit ? locals.Save : locals.Edit}
|
||||||
icon={PencilIcon}
|
icon={PencilIcon}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
if (edit) {
|
||||||
notes[params.id].name = name;
|
notes[params.id].name = name;
|
||||||
notes[params.id].text = text;
|
notes[params.id].text = text;
|
||||||
|
|
||||||
localStorage.setObj("Notes", notes);
|
localStorage.setObj("Notes", notes);
|
||||||
|
}
|
||||||
|
|
||||||
setEdit(!edit);
|
setEdit(!edit);
|
||||||
}}
|
}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue