Skip to content

Commit b93f414

Browse files
committed
fix(docs): 스크롤 안되는 버그 수정
1 parent 777445c commit b93f414

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

components/Editor/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,10 @@ const Editor = ({ contents = "", title = "", docsType = "", mode }: EditorPropsT
204204
)}
205205
<textarea
206206
onKeyDown={(e) => setCursorPosition((e.target as HTMLTextAreaElement).selectionStart)}
207-
onChange={(e) => setDocs((prev) => ({ ...prev, contents: autoClosingTag(e) }))}
208-
value={docs.contents}
207+
onChange={(e) =>
208+
setDocs((prev) => ({ ...prev, contents: autoClosingTag(e).replaceAll("<br>", "\n") }))
209+
}
210+
value={docs.contents.replaceAll("<br>", "\n")}
209211
placeholder="문서 내용을 입력해주세요. 사진 또는 동영상을 넣으려면 파일을 드래그&드롭하세요..."
210212
className={styles.textarea[String(isExampleOpen)]}
211213
/>

components/Editor/style.css.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const previewBox = style({
4141
background: theme.preview,
4242
padding: "42px",
4343
gap: "12px",
44+
overflowY: "scroll",
4445
...font.p1,
4546
...flex.COLUMN_FLEX,
4647
});
@@ -123,6 +124,7 @@ export const docsType = styleVariants<Record<string, ComplexStyleRule>>({
123124
});
124125

125126
const textareaBase = style({
127+
whiteSpace: "pre-wrap",
126128
width: "100%",
127129
marginTop: "12px",
128130
...font.p1,

0 commit comments

Comments
 (0)