import React, { useContext, useState } from "react"; import { NoteContext, UndoRedoContext } from "../pages/editor"; import { Action, ObjectType } from "../data/data"; export default function Note(props) { const { updateNote } = 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; updateNote(props.data.id, { content: e.target.value, height: newHeight }); }; return (
); }