Skip to content

Commit 2cb237b

Browse files
authored
🎨 style: 폰트 클래스 추가 및 기존 폰트 매핑 제거
🎨 style: 폰트 클래스 추가 및 기존 폰트 매핑 제거
2 parents 6062c18 + 1414837 commit 2cb237b

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

src/components/Editor/Editor.jsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@ const formats = [
1313
'background',
1414
];
1515

16-
const fontFamilyMap = {
17-
나눔명조: '"Nanum Myeongjo", serif',
18-
'나눔손글씨 손편지체': '"Nanum Sonpyeonji Ce", cursive',
19-
Pretendard: '"Pretendard", sans-serif',
20-
'Noto Sans': '"Noto Sans", sans-serif',
21-
};
22-
2316
export default function Editor({ value, onChange, font, onBlur, isError }) {
2417
const quillRef = useRef();
2518

@@ -36,10 +29,18 @@ export default function Editor({ value, onChange, font, onBlur, isError }) {
3629

3730
useEffect(() => {
3831
const editorRoot = quillRef.current?.editor?.root;
39-
if (editorRoot) {
40-
editorRoot.style.fontFamily =
41-
fontFamilyMap[font] || '"Noto Sans", sans-serif';
42-
editorRoot.style.fontSize = '18px';
32+
if (!editorRoot) return;
33+
34+
editorRoot.classList.remove(
35+
'font-나눔명조',
36+
'font-나눔손글씨손편지체',
37+
'font-Pretendard',
38+
'font-NotoSans',
39+
);
40+
41+
if (font) {
42+
const fontClassName = `font-${font.replace(/\s/g, '')}`;
43+
editorRoot.classList.add(fontClassName);
4344
}
4445
}, [font]);
4546

src/components/Editor/Editor.module.scss

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,24 @@
6565
}
6666
}
6767
}
68+
69+
:global(.ql-editor) {
70+
font-family: 'Noto Sans', sans-serif;
71+
font-size: 1.8rem;
72+
}
73+
74+
:global(.ql-editor.font-나눔명조) {
75+
font-family: '나눔명조', serif;
76+
}
77+
78+
:global(.ql-editor.font-나눔손글씨손편지체) {
79+
font-family: '나눔손글씨 손편지체', cursive;
80+
}
81+
82+
:global(.ql-editor.font-Pretendard) {
83+
font-family: 'Pretendard', sans-serif;
84+
}
85+
86+
:global(.ql-editor.font-NotoSans) {
87+
font-family: 'Noto Sans', sans-serif;
88+
}

0 commit comments

Comments
 (0)