@toast-ui/react-editor 만 설치하고 사용 가능하다
사용방법은 공식문서에 나온 것을 그대로 따라하면 된다
const onChange = () => {
    const editorHtml = editorRef.current!.getInstance().getHTML();
    setHtml(editorHtml);
  };
<Editor
  ref={editorRef as React.LegacyRef<Editor>}
  initialValue={html}
  previewStyle="vertical"
  height="100%"
  initialEditType="wysiwyg"
  useCommandShortcut
  plugins={[colorSyntax]}
  toolbarItems={[['heading', 'bold']]}
  onChange={onChange}
  hideModeSwitch
  />
import { Editor, Viewer } from '@toast-ui/react-editor';
라이브러리에서 가져오는 Editor는 클래스이다
그래서 인지 함수컴포넌트에서 사용하는 useRef와 타입이 잘 맞지 않는 문제가 있었다
그래서 강제로 타입 캐스팅을 해서 맞춰주었다
<Editor
  ref={editorRef as React.LegacyRef<Editor>}
  // ...
  />
const ToastUiEditor = () => {
  const [focusedComponentId, setFocusedComponentId] = React.useState<string>('');
  const handleClickComponent = (id: string) => {
    setFocusedComponentId(id);
  };
  // const handleClickBackground = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
  return (
    // CustomCommonLayout click event가 정확히 일치하는 경우에만 발생한다
    <CustomCommonLayout
      onClick={(e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
        if (e.target === e.currentTarget) {
          setFocusedComponentId('');
        }
      }}
    >
      <EditCard
        id="card-1"
        isEditorMode={focusedComponentId === 'card-1'}
        handleClickComponent={handleClickComponent}
      />
      <EditCard
        id="card-2"
        isEditorMode={focusedComponentId === 'card-2'}
        handleClickComponent={handleClickComponent}
      />
    </CustomCommonLayout>
  );
};