하, 센세
글쓰기 기능에 React Quill 설치해서 사용하려고 합니다.
Write 페이지에 접속하면 제목 칸을 클릭하면 커서가 활성화 되어서 내용이 적히는데
Rich Text 칸에는 커서 활성화가 되지 않습니다. 툴바에 있는 버튼을 누르면 또 활성화 됩니다.
구글링 했더니 value를 defaultValue로 바꾸면 된다고 해서 바꿨더니 안되고,
리액트 앱 새로 만들어서 quill 깔았더니 그때는 바로 커서가 활성화됩니다.
그러면 제 프로젝트 상에서 뭔가 충돌하는게 있다는 것인데...
한번 봐주시면 감사하겠습니다.
function Write() {
const [value, setValue] = useState("");
const modules = {
toolbar: [
[{ header: [1, 2, 3, 4, 5, 6, false] }],
[{ font: [] }],
[{ size: [] }],
["bold", "italic", "underline", "strike", "blockquote"],
[
{ list: "ordered" },
{ list: "bullet" },
{ indent: "-1" },
{ indent: "+1" },
],
["link", "image", "video"],
],
};
return (
<div className="container">
<Form action="http://localhost:8080/add" method="POST">
<Form.Group className="mb-3" controlId="exampleForm.ControlInput1">
<Form.Label>Title</Form.Label>
<Form.Control type="text" name="title" placeholder="Title" />
</Form.Group>
<input type="hidden" name="text" value={value} />
<ReactQuill
theme="snow"
value={value}
onChange={(content, delta, source, editor) => setValue(content)}
modules={modules}
style={{ height: "250px" }}
/>
<Button variant="primary" type="submit" className="mt-5">
Submit
</Button>
</Form>
</div>
);
}