import React, { useContext, useState } from "react"; import { NoteContext, UndoRedoContext } from "../pages/editor"; import { Action, ObjectType } from "../data/data"; export default function Note(props) { const { setNotes } = useContext(NoteContext); const w = 180; const r = 3; const fold = 24; const { setUndoStack, setRedoStack } = useContext(UndoRedoContext); const [editField, setEditField] = useState({}); const handleChange = (e) => { const textarea = document.getElementById(`note_${props.data.id}`); textarea.style.height = "0"; textarea.style.height = textarea.scrollHeight + "px"; const newHeight = textarea.scrollHeight + 41; setNotes((prev) => prev.map((n) => { if (n.id === props.data.id) { return { ...n, content: e.target.value, height: newHeight }; } return n; }) ); }; return (
); }