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/post page #55

Merged
merged 70 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
e04eac5
feat(DefaultButton): onClick ์†์„ฑ ์ถ”๊ฐ€
nno3onn Feb 10, 2023
8ed1dc2
feat(Banner): Banner ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„
nno3onn Feb 10, 2023
7bf280a
fix: ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜
nno3onn Feb 10, 2023
952d316
feat(Tabs): Tabs ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„
nno3onn Feb 10, 2023
4027d23
fix: ๋ถˆํ•„์š”ํ•œ ์ฝ”๋“œ ์ œ๊ฑฐ
nno3onn Feb 10, 2023
bc37ce1
fix: ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜
nno3onn Feb 10, 2023
eaa2677
feat(SwitchButton): MyPage์˜ SwitchButton ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„
nno3onn Feb 10, 2023
f97e665
fix: ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜
nno3onn Feb 10, 2023
8d53eba
feat(PositionTag): MyPage์˜ PositionTag ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„
nno3onn Feb 10, 2023
7229c1c
fix: ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜
nno3onn Feb 10, 2023
9e7dcb0
feat(ProfileContainer): MyPage์˜ ProfileContainer ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„
nno3onn Feb 10, 2023
f70192e
fix: ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜
nno3onn Feb 10, 2023
d458229
feat: Tags ์ปดํฌ๋„ŒํŠธ UI ์ƒ์„ฑ
arch-spatula Feb 10, 2023
9498b96
refactor: Tags.tsx Props type ์‹๋ณ„์ž๋ช… ์ˆ˜์ •
arch-spatula Feb 10, 2023
95cb625
feat: Card.tsx, IconCount.tsx: ์ปดํฌ๋„ŒํŠธ ์ตœ์ดˆ๊ตฌํ˜„
arch-spatula Feb 10, 2023
e7ed400
refactor(CardItem, Tags, IconCount): ์ค‘์•™์ •๋ ฌ, ๋ฌธ์„œํ™”
arch-spatula Feb 10, 2023
a9caa44
refactor (IconWithCount, Tags): ๋ชจ๋“ˆ๋ช… ์ˆ˜์ •, Tag ์ค„๋ฐ”๊ฟˆ ๋ณ€๊ฒฝ
arch-spatula Feb 10, 2023
f3ec1d2
feat (ico-hart.svg): ์ข‹์•„์š” ์•„์ด์ฝ˜ ์ถ”๊ฐ€
arch-spatula Feb 10, 2023
c52786b
docs (CardItem, Tags): ๋ชจ๋“ˆ๋ช…๊ณผ ์ปดํฌ๋„ŒํŠธ ์ด๋ฆ„ ํ†ต์ผ Tag ๋ฌธ์„œํ™”
arch-spatula Feb 10, 2023
aa2839f
chore: toast ui Add dependencieds
hyoloui Feb 10, 2023
aaa7b18
Revert "chore: toast ui Add dependencieds"
hyoloui Feb 10, 2023
e48ad53
feat: DropDown.tsx: ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„
hyoloui Feb 10, 2023
4d6f749
style: DropDown ์Šคํƒ€์ผ ์ ์šฉ
hyoloui Feb 10, 2023
d359b1b
feat: DropDown types ๊ฐ„์†Œํ™”
hyoloui Feb 10, 2023
6d43e06
refac: DropDown ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜
hyoloui Feb 10, 2023
ac90153
refac: DropDown type
hyoloui Feb 10, 2023
237b211
feat: ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ ์ƒ์„ฑ #6
yunjunhojj Feb 10, 2023
49a40e8
feat: ๋กœ๊ทธ์ธ ๋ฒ„ํŠผ export ์‹ ๊ธฐ์ˆ  ๋„์ž…
yunjunhojj Feb 10, 2023
1500798
feat: ์“ธ๋ฐ์—†๋Š” ์ฝ”๋“œ ์‚ญ์ œ #6
yunjunhojj Feb 10, 2023
fc3469b
Update index.tsx
yunjunhojj Feb 10, 2023
9785c38
feat(SideBar): ์‚ฌ์ด๋“œ๋ฐ” ์ปดํฌ๋„ŒํŠธ ์ œ์ž‘
Jeremy-Kr Feb 10, 2023
fdec648
refactor: DropDown.tsx
hyoloui Feb 10, 2023
cd8b13a
Update DropDown.tsx
hyoloui Feb 11, 2023
a770b6f
feat: PostTitle ์ปดํฌ๋„ŒํŠธ
hyoloui Feb 10, 2023
7a69158
refactor: PostTitle.tsx
hyoloui Feb 11, 2023
44179be
feat: file input ์ž‘์—…์ค‘
hyoloui Feb 11, 2023
cb0c0c6
feat: PostTitle.tsx ํŒŒ์ผ ์—…๋กœ๋“œ ์ถ”๊ฐ€๊ธฐ๋Šฅ
hyoloui Feb 12, 2023
a18eae4
feat:(post) ํฌ์ŠคํŠธ ํŽ˜์ด์ง€
hyoloui Feb 13, 2023
8675cdb
Merge branch 'feat/PostPage' of https://github.com/react-challengers/โ€ฆ
hyoloui Feb 14, 2023
8f68745
Merge branch 'dev' of https://github.com/react-challengers/Codefolio โ€ฆ
arch-spatula Feb 14, 2023
fe9bc5a
Merge branch 'dev' of https://github.com/react-challengers/Codefolio โ€ฆ
hyoloui Feb 14, 2023
104383b
move:(post)
hyoloui Feb 14, 2023
f1230b5
feat: (post) state props ์ง€์ •
hyoloui Feb 14, 2023
0a5c013
Merge branch 'feat/PostPage' of https://github.com/react-challengers/โ€ฆ
arch-spatula Feb 14, 2023
155b29d
feat(Post, PostEditor): toast ui ์ถ”๊ฐ€
arch-spatula Feb 14, 2023
ce74723
feat: (PostEditor) colorSyntax ์ ์šฉ
hyoloui Feb 14, 2023
aa33703
feat(ProjectInfo, InfoDropDown, Post): state ์ค‘์•™ํ™”
arch-spatula Feb 14, 2023
b77ae74
feat(post): post page state ๊ด€๋ฆฌ
hyoloui Feb 14, 2023
05a1f67
feat(ProjectInfo & DropDown, Post): ์—”ํ„ฐ๋กœ tag์ถ”๊ฐ€
arch-spatula Feb 14, 2023
bd6d848
Merge branch 'dev' of https://github.com/react-challengers/Codefolio โ€ฆ
arch-spatula Feb 14, 2023
aa67f7c
feat(ProjectInfoDropDown): FieldDropDown ๊ตฌํ˜„ ์ค‘
arch-spatula Feb 14, 2023
97d954a
feat(ProjectInfo & DropDown, post, FiledDropDown): post page update
hyoloui Feb 14, 2023
b77aa01
fix(post): @TODO ์ˆ˜์ •
hyoloui Feb 15, 2023
99849c8
fix(post): ํด๋” ๊ตฌ์กฐ ๋ณ€๊ฒฝ
hyoloui Feb 15, 2023
a00363d
feat(PostPage): ํ”„๋กœ์ ํŠธ ์ •๋ณด ๊ตฌํ˜„ ์ค‘
nno3onn Feb 15, 2023
c7dd5a4
feat(PostPage): UI ๊ตฌํ˜„ ์™„๋ฃŒ
nno3onn Feb 15, 2023
b6573d2
feat(PostEditor): ๋ทฐ์–ด ์ด๋ฏธ์ง€ ์••์ถ•, ๋ณด์ด๊ธฐ
hyoloui Feb 15, 2023
93c7119
fix(FiledDropDown): ์นดํ…Œ๊ณ ๋ฆฌ ํด๋ฆญ ์—๋Ÿฌ ํ•ด๊ฒฐ
hyoloui Feb 15, 2023
88c586b
Merge branch 'feat/PostPage' of https://github.com/react-challengers/โ€ฆ
hyoloui Feb 15, 2023
3007884
fix(post): self is not ์—๋Ÿฌ ํ•ด๊ฒฐ
hyoloui Feb 15, 2023
6360524
Merge branch 'dev' of https://github.com/react-challengers/Codefolio โ€ฆ
nno3onn Feb 15, 2023
f912296
feat(PostEditor): ๋ฐ์ดํ„ฐ ์ทจ๋“
hyoloui Feb 15, 2023
b7fd9ce
feat(Post, Editor): state์™€ Page๋กœ ์ค‘์•™ํ™”
arch-spatula Feb 15, 2023
3828f46
feat(Post, PostEditor): supabase ์„œ๋ฒ„ ํ†ต์‹ 
hyoloui Feb 15, 2023
c1c859c
fix: px -> rem ํฐํŠธ ์‚ฌ์ด์ฆˆ ๋ณ€๊ฒฝ
nno3onn Feb 15, 2023
81d7d2b
Merge branch 'feat/PostPage' of https://github.com/react-challengers/โ€ฆ
nno3onn Feb 15, 2023
dd03a46
feat: post create ์ž‘์„ฑ
Jeremy-Kr Feb 15, 2023
7c9be10
Merge branch 'dev' into feat/PostPage
Jeremy-Kr Feb 15, 2023
118f27f
docs(PostEditor, types): ๋ถˆํ•„์š”ํ•œ ์ฃผ์„ ๋ฐ ํ‚ค์›Œ๋“œ ์‚ญ์ œ
arch-spatula Feb 15, 2023
2cb53a5
fix: PR ์ค‘ ํ”ผ๋“œ๋ฐฑ์„ ๋ฐ˜์˜ํ•ฉ๋‹ˆ๋‹ค.
Jeremy-Kr Feb 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
{ "namedComponents": "arrow-function" }
],
// no-extraneous-dependencies ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ด ์ž„์‹œ๋กœ ํ•ด์ œ
"import/no-extraneous-dependencies": 0
"import/no-extraneous-dependencies": 0,
"@typescript-eslint/ban-ts-comment": 0
}
}
1 change: 0 additions & 1 deletion Components/Common/DropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ const DropDown = ({ type }: DropDownProps) => {
const onChangeHandler = (e: React.ChangeEvent<HTMLSelectElement>) => {
setSelectValue(e.target.value);
};

return (
<Select onChange={onChangeHandler} defaultValue={options[0]}>
{options.map((option) => (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import styled from "styled-components";
import Skill, { commonStyle } from "./Skill";

interface SkillPickerProps {
text: string;
editSkills: string[];
setEditSkills: Dispatch<React.SetStateAction<string[]>>;
}

const SkillList = ({ editSkills, setEditSkills }: SkillPickerProps) => {
const SkillList = ({ text, editSkills, setEditSkills }: SkillPickerProps) => {
const addSkill = () => {
if (editSkills[editSkills.length - 1] !== "")
setEditSkills([...editSkills, ""]);
Expand All @@ -29,7 +30,7 @@ const SkillList = ({ editSkills, setEditSkills }: SkillPickerProps) => {
onDelete={onDelete}
/>
))}
<SkillButton onClick={addSkill}>+ ์Šคํ‚ฌ ์ž…๋ ฅ</SkillButton>
<SkillButton onClick={addSkill}>+ {text}</SkillButton>
</SkillListContainer>
);
};
Expand Down
3 changes: 2 additions & 1 deletion Components/MyPage/EditProfileContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import { Dispatch, useState } from "react";
import styled from "styled-components";
import DefaultButton from "../Common/DefaultButton";
import DropDown from "../Common/DropDown";
import SkillList from "../Common/Skill/SkillList";
import Toggle from "../Common/Toggle";
import PositionTag from "./PositionTag";
import ProfileContainer from "./ProfileContainer";
import { ContentContainer, ContentWrapper } from "./ShowProfileContainer";
import SkillList from "./SkillList";
import SwitchButton from "./SwitchButton";

const fieldList = [
Expand Down Expand Up @@ -108,6 +108,7 @@ const EditProfileContainer = ({
<ContentWrapper>
<p>์Šคํ‚ฌ</p>
<SkillList
text="์Šคํ‚ฌ ์ž…๋ ฅ"
editSkills={editSkills}
setEditSkills={setEditSkills}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { postLargeCategory, postSubCategory } from "@/lib/recoil";
import { useReducer } from "react";
import { useSetRecoilState } from "recoil";
import styled from "styled-components";

/**
Expand Down Expand Up @@ -51,16 +53,27 @@ const reducer = (_state: string[], action: { type: Field }): string[] => {

const FieldDropDown = () => {
const [state, dispatch] = useReducer(reducer, initialState);

const setLargeCategory = useSetRecoilState(postLargeCategory);
const setSubCategory = useSetRecoilState(postSubCategory);

const handleLargeCategory = (item: Field) => {
dispatch({ type: item });
};

const handleClickSubCategory = (item: string) => {
setSubCategory(item);
};

return (
<FieldDropDownContainer>
<ul>
{field.map((item) => (
<FiledItemContainer
onMouseOver={() => handleLargeCategory(item)}
onMouseOver={() => {
handleLargeCategory(item);
setLargeCategory(item);
}}
key={item.toString()}
>
{item}
Expand All @@ -70,7 +83,11 @@ const FieldDropDown = () => {
<Divider />
<ul>
{state.map((item) => (
<FiledItemContainer key={item.toString()} cursor>
<FiledItemContainer
key={item.toString()}
onClick={() => handleClickSubCategory(item)}
dataCursor
>
{item}
</FiledItemContainer>
))}
Expand All @@ -79,28 +96,32 @@ const FieldDropDown = () => {
);
};

const FieldDropDownContainer = styled.div`
width: 21.5rem;
box-shadow: 0px 0.25rem 0.25rem rgba(0, 0, 0, 0.25);
border: 1px solid #cccccc;
display: flex;
border-radius: 0.2rem;
gap: 0;
position: absolute;
background-color: #fff;
z-index: 21;
`;

const FiledItemContainer = styled.li<{
key?: string;
onMouseOver?: () => void;
cursor?: boolean;
onClick?: () => void;
dataCursor?: boolean;
}>`
padding: 0.75rem;
width: 8.75rem;
${(props) => props.cursor && "cursor: pointer;"};
${(props) => props.dataCursor && "cursor: pointer;"};
:hover {
background: #e6e6e6;
}
`;

const FieldDropDownContainer = styled.div`
width: 21.5rem;
box-shadow: 0px 0.25rem 0.25rem rgba(0, 0, 0, 0.25);
border: 1px solid #cccccc;
display: flex;
border-radius: 0.2rem;
gap: 0;
`;

const Divider = styled.hr`
padding: 0;
margin: 0;
Expand Down
124 changes: 124 additions & 0 deletions Components/Post/Post.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import { NextPage } from "next";
import styled from "styled-components";
import DefaultButton from "@/Components/Common/DefaultButton";
import PostTitle from "@/Components/Post/PostTitle";
import ProjectInfo from "@/Components/Post/ProjectInfo";
import { useRecoilValue } from "recoil";
import {
postContent,
postLargeCategory as recoilPostLargeCategory,
postMembers,
postProjectDuration,
postPublic,
postSkills,
postSubCategory as recoilPostSubCategory,
postSubTitle,
postTags,
postTitle,
postTitleBackgroundColor,
} from "@/lib/recoil";
import supabase from "@/lib/supabase";
import { useEffect, useState } from "react";
import { useRouter } from "next/router";

/**
* @TODO ์ฝ”๋“œ๋ธ”๋Ÿญ
* @TODO ๊ฒŒ์‹œ ์ „ ์ž…๋ ฅ์ฐฝ ์ถ”๊ฐ€(์ธ์›, ๊ธฐ๊ฐ„ ๋“ฑ - ํ”ผ๊ทธ๋งˆ ์ฐธ๊ณ )
Jeremy-Kr marked this conversation as resolved.
Show resolved Hide resolved
* @TODO file(img) input ์—์„œ color picker๋กœ ๋ณ€๊ฒฝ
Jeremy-Kr marked this conversation as resolved.
Show resolved Hide resolved
* @TODO date picker z-index ํ•ด๊ฒฐ
Jeremy-Kr marked this conversation as resolved.
Show resolved Hide resolved
* @TODO Date recoil์„ ํ™œ์šฉํ•œ custom hook์œผ๋กœ ๋ฆฌํŒฉํ† ๋งํ•˜๊ธฐ
* @TODO ๊ฐœ๋ฐœ์Šคํƒ UI my-page ์ฐธ๊ณ 
* @TODO ์นดํ…Œ๊ณ ๋ฆฌ ์ค‘๋ณต ์„ ํƒ , ๋ณด์—ฌ์ฃผ๋Š” UI
* @TODO ์„œ๋ฒ„ํ†ต์‹  ์—ฐ๊ฒฐ
Jeremy-Kr marked this conversation as resolved.
Show resolved Hide resolved
*/
const Post: NextPage = () => {
const title = useRecoilValue(postTitle);
const subTitle = useRecoilValue(postSubTitle);
const titleBackgroundColor = useRecoilValue(postTitleBackgroundColor);
const [startDate, endDate] = useRecoilValue(postProjectDuration);
const skills = useRecoilValue(postSkills);
const tag = useRecoilValue(postTags);
const isPublic = useRecoilValue(postPublic);
const members = useRecoilValue(postMembers);
const content = useRecoilValue(postContent);
const postLargeCategory = useRecoilValue(recoilPostLargeCategory);
const postSubCategory = useRecoilValue(recoilPostSubCategory);

const router = useRouter();

const newPostRow = {
title,
sub_title: subTitle,
title_background_color: titleBackgroundColor,
large_category: postLargeCategory,
sub_category: postSubCategory,
skills,
progress_date: [startDate, endDate],
members,
tag,
is_public: isPublic,
content,
};

const [isSaved, setIsSaved] = useState(false);

const onSave = () => {
// ์ €์žฅ ๋ฒ„ํŠผ
setIsSaved(true);
setTimeout(() => {
setIsSaved(false);
}, 2000);
};
const onPost = async () => {
// ๊ฒŒ์‹œ ๋ฒ„ํŠผ
const { data, error } = await supabase
.from("post")
.insert(newPostRow)
.select()
.single();
if (!error) {
router.push({
pathname: "/",
query: { id: data.id },
});
}
};

return (
<MainWrapper>
<PostHeader>
<SaveAlert isSaved={isSaved}>๊ธ€์ด ์ €์žฅ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.</SaveAlert>
<DefaultButton text="์ €์žฅ" type="outline" size="s" onClick={onSave} />
<DefaultButton text="๊ฒŒ์‹œ" type="full" size="s" onClick={onPost} />
</PostHeader>
<section>
<PostTitle />
<ProjectInfo />
</section>
</MainWrapper>
);
};

const MainWrapper = styled.main`
max-width: 98.75rem;
margin: 0 auto;
`;

const PostHeader = styled.section`
display: flex;
align-items: center;
justify-content: flex-end;
padding: 2.8125rem 0;
gap: 1.25rem;
`;

interface SaveAlertProps {
isSaved: boolean;
}

const SaveAlert = styled.span<SaveAlertProps>`
opacity: ${({ isSaved }) => (isSaved ? 1 : 0)};
transition: all 0.5s ease-in-out;
`;

export default Post;
117 changes: 117 additions & 0 deletions Components/Post/PostEditor.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import "@toast-ui/editor/dist/toastui-editor.css";
import "@toast-ui/editor/dist/theme/toastui-editor-dark.css";
import "tui-color-picker/dist/tui-color-picker.css";
import "@toast-ui/editor-plugin-color-syntax/dist/toastui-editor-plugin-color-syntax.css";
import "@toast-ui/editor/dist/i18n/ko-kr";

import { Editor } from "@toast-ui/react-editor";
import colorSyntax from "@toast-ui/editor-plugin-color-syntax";
import { RefObject, useEffect } from "react";
import supabase from "@/lib/supabase";
import imageCompression from "browser-image-compression";
import { useRecoilState } from "recoil";
import { postContent as recoilPostContent } from "@/lib/recoil";

/**
* @TODO storage ์‚ญ์ œ ๊ตฌํ˜„ ํ•„์š”
* @TODO uuid flag ๊ฝƒ์•„์•ผ ํ•จ >> ๊ฒŒ์‹œ์™€ ์ž„์‹œ์ €์žฅ์˜ ์šฉ๋„๋กœ ๋ถ„๋ฅ˜
*/

interface PostEditorProps {
editorRef: RefObject<Editor>;
}

const PostEditor = ({ editorRef }: PostEditorProps) => {
const [postContent, setPostContent] = useRecoilState(recoilPostContent);
const toolbarItems = [
["heading", "bold", "italic", "strike"],
["hr"],
["ul", "ol", "task"],
["table", "link"],
["image"], // <-- ์ด๋ฏธ์ง€ ์ถ”๊ฐ€ ํˆด๋ฐ”
["code"],
["scrollSync"],
];

useEffect(() => {
if (editorRef.current) {
const editorIns = editorRef.current.getInstance();
editorIns.removeHook("addImageBlobHook");
editorIns.addHook("addImageBlobHook", addImage);
}
}, []);

// ------------- image Function ------------- // ์—๋””ํ„ฐ์— ์ด๋ฏธ์ง€ ์ถ”๊ฐ€

type HookCallback = (url: string, text?: string) => void;

const addImage = async (blob: File, dropImage: HookCallback) => {
const img = await compressImg(blob); // ์ด๋ฏธ์ง€ ์••์ถ•
if (!img) return;
const url = await uploadImage(img); // ์—…๋กœ๋“œ๋œ ์ด๋ฏธ์ง€ ์„œ๋ฒ„ url
if (!url) return;
dropImage(url, `${blob.name}`); // ์—๋””ํ„ฐ์— ์ด๋ฏธ์ง€ ์ถ”๊ฐ€
};

// ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ

const uploadImage = async (blob: File) => {
try {
const imgPath = crypto.randomUUID();
await supabase.storage.from("post-image").upload(imgPath, blob);

// ์ด๋ฏธ์ง€ ์˜ฌ๋ฆฌ๊ธฐ
const urlResult = await supabase.storage
.from("post-image")
.getPublicUrl(imgPath);
return urlResult.data.publicUrl;
} catch (error) {
console.log(error);
return false;
}
};

// //์ด๋ฏธ์ง€ ์••์ถ•
const compressImg = async (blob: File): Promise<File | void> => {
const options = {
maxSize: 1,
initialQuality: 0.55, // initial 0.7
};
const result = await imageCompression(blob, options)
.then((res) => res)
.catch((e) => console.log(e, "์••์ถ• ์—๋Ÿฌ"));
return result;
};

const handleOnEditorChange = () => {
// ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ
const editorText = editorRef.current?.getInstance().getMarkdown();
if (editorText === " " || editorText === "" || editorText === undefined) {
return;
}
// HTML ๋Œ€์‹ ์— Markdown์œผ๋กœ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.
setPostContent(editorText);
};

return (
<Editor
ref={editorRef}
initialValue={postContent ?? null}
previewStyle="vertical"
// previewHighlight={false}
height="600px"
initialEditType="markdown"
useCommandShortcut
toolbarItems={toolbarItems}
language="ko-KR"
plugins={[colorSyntax]}
hooks={{
// @ts-ignore
addImageBlobHook: addImage,
}}
onChange={() => handleOnEditorChange()}
/>
);
};

export default PostEditor;
Loading