sokko-g/website/src/features/toolboxes/modules/MemoTextEditor.jsx
Shinuwa 22b397ebfa Document Sokko G's architecture and folders, and move JavaScript file headers to JSDoc @file blocks
Add ARCHITECTURE.md (layers, flows, folder map, glossary), CONTRIBUTING.md
(setup and step-by-step recipes) and a README in each main folder, with an
index of docs/. Convert the 511 JavaScript headers from "// Rôle :" lines to
JSDoc @file blocks, define a three-level header template in website/AGENTS.md
and check the header in tests/file-headers.test.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 09:42:13 +01:00

32 lines
954 B
JavaScript

/**
* @file Conserve le brouillon d'un mémo et ajuste la hauteur de son champ.
*/
import { useLayoutEffect } from "react";
import { useInlineEdit } from "../../../hooks/useInlineEdit.js";
export function MemoTextEditor({ text, textContent, onCommit }) {
const { draft, setDraft, inputRef, commit } = useInlineEdit({ value: text, onCommit, commitUnchanged: true });
useLayoutEffect(() => {
const element = inputRef.current;
if (!element) return;
element.style.height = "auto";
element.style.height = `${element.scrollHeight + 2}px`;
});
return (
<textarea
className="nds-textarea"
data-size="sm"
data-variant="ghost"
ref={inputRef}
value={draft}
rows={3}
placeholder={textContent.placeholder || "Mémo court..."}
onChange={(event) => setDraft(event.target.value)}
onBlur={() => commit()}
aria-label={textContent.editLabel || "Modifier le mémo"}
/>
);
}