-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/#29 텍스트 에디터 - quill 추가 #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
The head ref may contain hidden characters: "feature/#29_\uD14D\uC2A4\uD2B8-\uC5D0\uB514\uD130---Quill-\uCD94\uAC00"
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
dd22f2b
📦 react-quill-new 패키지 설치
haksoo0918 d70fa96
✨ TextEditor 컴포넌트 추가, editor 테스트 페이지 추가
haksoo0918 9eefcbd
Merge branch 'develop' into feature/#29_텍스트-에디터---Quill-추가
haksoo0918 7bd821f
🔨 에디터 테스트 페이지 로그 제거
haksoo0918 05fd75f
🐛 jsDoc return 부분 삭제
haksoo0918 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| import dynamic from 'next/dynamic'; | ||
|
|
||
| import 'react-quill-new/dist/quill.snow.css'; | ||
|
|
||
| // ref: https://www.npmjs.com/package/react-quill-new | ||
| const QuillEditor = dynamic(() => import('react-quill-new'), { | ||
| ssr: false, | ||
| loading: () => <p>편집기 불러오는 중...</p>, | ||
| }); | ||
|
|
||
| interface Props { | ||
| value?: string; | ||
| onChange: (value: string) => void; | ||
| } | ||
|
|
||
| /** | ||
| * 텍스트 에디터 컴포넌트 | ||
| * @param {object} props | ||
| * @param {string} props.value - 초기 값 | ||
| * @param {function} props.onChange - 값 변경시 콜백 함수 | ||
| */ | ||
| export default function TextEditor({ value = '', onChange }: Props) { | ||
| const modules = { | ||
| toolbar: { | ||
| container: [ | ||
| [{ header: [1, 2, 3, false] }], | ||
| ['bold', 'italic', 'underline'], | ||
| [{ align: null }, { align: 'center' }, { align: 'right' }], | ||
| [{ list: 'ordered' }, { list: 'bullet' }], | ||
| ['blockquote', 'link', 'image'], | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| const handleChange = (value: string) => { | ||
| onChange(value); | ||
| }; | ||
|
|
||
| return ( | ||
| <QuillEditor | ||
| theme="snow" | ||
| value={value} | ||
| onChange={handleChange} | ||
| modules={modules} | ||
| placeholder="본문을 입력해 주세요." | ||
| className="quill-custom" | ||
| /> | ||
| ); | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { useState } from 'react'; | ||
|
|
||
| import TextEditor from '@/components/TextEditor'; | ||
|
|
||
| const cellStyle = 'px-4 py-2'; | ||
| const trStyle = 'border-b'; | ||
|
|
||
| export default function Editor() { | ||
| const [value, setValue] = useState(''); | ||
|
|
||
| const handleChange = (v: string) => { | ||
| // console.log('value', v); | ||
| setValue(v); | ||
| }; | ||
haksoo0918 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| return ( | ||
| <div className="flex table-fixed items-center justify-center"> | ||
| <table className="w-[1000px]"> | ||
| <thead> | ||
| <tr className={trStyle}> | ||
| <th scope="col" className={cellStyle}> | ||
| props | ||
| </th> | ||
| <th scope="col" className={cellStyle}> | ||
| example | ||
| </th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr className={trStyle}> | ||
| <td className={cellStyle}> | ||
| <ul> | ||
| <li>value: string</li> | ||
| <li>onChange: (value: string) => void</li> | ||
| </ul> | ||
| </td> | ||
| <td className={cellStyle}> | ||
| <div className="h-[300px] w-[600px]"> | ||
| <TextEditor value={value} onChange={handleChange} /> | ||
| </div> | ||
| <hr className="my-4" /> | ||
| <p className="font-bold"> | ||
| 참고: 에디터의 크기는 에디터 부모의 100%가 적용되니 부모의 | ||
| 크기를 정의하시면 됩니다. | ||
| </p> | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.