Skip to content

Commit 95d0157

Browse files
authored
Merge pull request #167 from pirogramming/hyungju/main
feat: form에서 회고 입력할 때 입력창이 줄 크기에 따라 동적으로 증가
2 parents 08b5cd2 + 9ba8c36 commit 95d0157

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

static/css/reflections.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,8 +1526,15 @@ button.ref-btn{
15261526
}
15271527

15281528
.ref-textarea {
1529-
font-size: 14px;
1530-
min-height: 120px;
1529+
width: 100%;
1530+
border: 0;
1531+
outline: 0;
1532+
resize: none; /* 수동 리사이즈 제거 */
1533+
overflow: hidden; /* 스크롤 제거 */
1534+
min-height: 120px; /* 기본 높이 */
1535+
font-size: 14.5px;
1536+
line-height: 1.55;
1537+
/* color: var(--gray-700); */
15311538
}
15321539

15331540
.ref-assets-grid {

static/js/reflections.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,20 @@
433433
});
434434
};
435435

436+
const bindAutoResizeTextarea = () => {
437+
const resize = (ta) => {
438+
ta.style.height = "auto";
439+
ta.style.height = ta.scrollHeight + "px";
440+
};
441+
442+
document.querySelectorAll(".ref-textarea").forEach((ta) => {
443+
// 초기 값 반영 (수정 페이지 대응)
444+
resize(ta);
445+
446+
ta.addEventListener("input", () => resize(ta));
447+
});
448+
};
449+
436450

437451

438452
/** ---------------------------
@@ -448,6 +462,7 @@
448462
bindBookmarkFilter();
449463
bindInsertTable();
450464
bindMDCopyBtn();
465+
bindAutoResizeTextarea();
451466
};
452467

453468
if (document.readyState === "loading") {

0 commit comments

Comments
 (0)