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: {
id: number;
onUpdatePage: (content: Pages.RequestContentPage) => void;
}) => {
return (
<textarea
id={String(props.id)}
class="editor"
autofocus
onInput={(e) => {
const text = e.currentTarget.value;
const lines = text.split("\n");
props.onUpdatePage({ id: props.id, title: lines[0] ?? "", text });
e.currentTarget.setAttribute("rows", String(Math.max(2, lines.length)));
}}
></textarea>
);
};
}) => (
<textarea
id={String(props.id)}
class="editor"
autofocus
onInput={(e) => {
const text = e.currentTarget.value;
const lines = text.split("\n");
props.onUpdatePage({ id: props.id, title: lines[0] ?? "", text });
e.currentTarget.setAttribute("rows", String(Math.max(2, lines.length)));
}}
></textarea>
);