mirror of
https://github.com/artegoser/AnoPaper.git
synced 2024-11-24 21:06:21 +03:00
fix: text updating in edit
This commit is contained in:
parent
b8c7c69012
commit
80858f53d9
1 changed files with 10 additions and 7 deletions
|
@ -37,6 +37,8 @@ function NotePage() {
|
||||||
let note = notes[params.id];
|
let note = notes[params.id];
|
||||||
|
|
||||||
let [edit, setEdit] = useState(false);
|
let [edit, setEdit] = useState(false);
|
||||||
|
let [text, setText] = useState(note.text);
|
||||||
|
let [name, setName] = useState(note.name);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="">
|
<div className="">
|
||||||
|
@ -52,17 +54,17 @@ function NotePage() {
|
||||||
<>
|
<>
|
||||||
<NoteNameInput
|
<NoteNameInput
|
||||||
value={note.name}
|
value={note.name}
|
||||||
onChange={(e) => (note.name = e.target.value)}
|
onChange={(e) => setName(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<NoteTextArea
|
<NoteTextArea
|
||||||
value={note.text}
|
value={note.text}
|
||||||
onChange={(e) => (note.text = 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={note.text}
|
||||||
onClick={(text) => {
|
onClick={(text) => {
|
||||||
note.text = text;
|
setText(text);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,11 +83,12 @@ function NotePage() {
|
||||||
text={locals.Edit}
|
text={locals.Edit}
|
||||||
icon={PencilIcon}
|
icon={PencilIcon}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setEdit(!edit);
|
notes[params.id].name = name;
|
||||||
|
notes[params.id].text = text;
|
||||||
|
|
||||||
if (edit) {
|
|
||||||
localStorage.setObj("Notes", notes);
|
localStorage.setObj("Notes", notes);
|
||||||
}
|
|
||||||
|
setEdit(!edit);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{!edit && (
|
{!edit && (
|
||||||
|
|
Loading…
Add table
Reference in a new issue