Skip to content

Latest commit

ย 

History

History
46 lines (39 loc) ยท 996 Bytes

[20200911]_quill_editor.md

File metadata and controls

46 lines (39 loc) ยท 996 Bytes

Quill editor

yarn add quill
import Quill from 'quill';
import 'quill/dist/quill.snow.css';
const QuillWrapper = styled.div``;

const Editor = () => {
  const quillElement = useRef(null);
  const quillInstance = useRef(null);

  useEffect(() => {
    quillInstance.current = new Quill(quillElement.current, {
      theme: 'snow',  // bubble or snow
      placeholder: '๋‚ด์šฉ์„ ์ž‘์„ฑํ•˜์„ธ์š”',
      modules: {
        toolbar: [
          [{ 'header': [1, 2, 3, 4, 5, 6, true] }],
          [{ 'size': ['small', false, 'large', 'huge'] }],
          ['bold', 'italic', 'underline', 'strike'],
          [{ 'color': [] }, { 'background': [] }],
          [{ list: 'ordered' }, { list: 'bullet' }],
          ['link', 'image'],
        ],
      },
    });
  }, []);

  return (
    <QuillWrapper>
      <div ref={quillElement} />
    </QuillWrapper>
  );
};

export default Editor;

toolbar options