mirror of
https://github.com/kou029w/quot.git
synced 2025-01-19 00:18:09 +00:00
dedent
This commit is contained in:
parent
6b942ef288
commit
031553612f
1 changed files with 13 additions and 15 deletions
|
@ -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>
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue