1
0
Fork 0
mirror of https://github.com/kou029w/quot.git synced 2025-01-19 00:18:09 +00:00
This commit is contained in:
Nebel 2022-08-24 15:27:10 +09:00
parent 6b942ef288
commit 031553612f

View file

@ -4,18 +4,16 @@ import "./editor.css";
export default (props: { export default (props: {
id: number; id: number;
onUpdatePage: (content: Pages.RequestContentPage) => void; onUpdatePage: (content: Pages.RequestContentPage) => void;
}) => { }) => (
return ( <textarea
<textarea id={String(props.id)}
id={String(props.id)} class="editor"
class="editor" autofocus
autofocus onInput={(e) => {
onInput={(e) => { const text = e.currentTarget.value;
const text = e.currentTarget.value; const lines = text.split("\n");
const lines = text.split("\n"); props.onUpdatePage({ id: props.id, title: lines[0] ?? "", text });
props.onUpdatePage({ id: props.id, title: lines[0] ?? "", text }); e.currentTarget.setAttribute("rows", String(Math.max(2, lines.length)));
e.currentTarget.setAttribute("rows", String(Math.max(2, lines.length))); }}
}} ></textarea>
></textarea> );
);
};