Skip to content
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

[Feat] 숫자 + 코, 숫자 + 단 입력시 텍스트에 스타일 적용되도록 #26

Merged
merged 10 commits into from
Apr 15, 2021
26 changes: 24 additions & 2 deletions src/pages/CreateDesign/Pattern/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,29 @@
import React from 'react';
import Editor from '@draft-js-plugins/editor';
import { EditorState } from 'draft-js';
import { useRef, useState } from 'react';

const Pattern = (): React.ReactElement => {
return <div>도안 작성 페이지</div>;
const [editorState, setEditorState] = useState<EditorState>(
EditorState.createEmpty(),
);
const editor = useRef<Editor | null>(null);

const focusEditor = (): void => {
editor?.current?.focus();
};

return (
<div>
<div onClick={focusEditor}>
<Editor
ref={editor}
editorState={editorState}
onChange={setEditorState}
placeholder="도안을 입력하세요"
zoripong marked this conversation as resolved.
Show resolved Hide resolved
/>
</div>
</div>
);
};

export default Pattern;