수정버튼 누르면 초기화
This commit is contained in:
parent
c68e8839b3
commit
86a6e5b27b
@ -473,16 +473,44 @@ const editComment = (comment) => {
|
|||||||
const isAnonymous = comment.author === "익명";
|
const isAnonymous = comment.author === "익명";
|
||||||
|
|
||||||
if (isMyComment) {
|
if (isMyComment) {
|
||||||
targetComment.isEditTextarea = !targetComment.isEditTextarea;
|
if (targetComment.isEditTextarea) {
|
||||||
lastCommentClickedButton.value = "edit";
|
// 수정창이 열려 있는 상태에서 다시 수정 버튼을 누르면 초기화
|
||||||
|
targetComment.isEditTextarea = false;
|
||||||
|
currentPasswordCommentId.value = comment.commentId;
|
||||||
|
} else {
|
||||||
|
// 다른 모든 댓글의 수정창 닫기
|
||||||
|
closeAllEditTextareas();
|
||||||
|
|
||||||
|
// 현재 댓글만 수정 모드 활성화
|
||||||
|
targetComment.isEditTextarea = true;
|
||||||
|
}
|
||||||
} else if (isAnonymous) {
|
} else if (isAnonymous) {
|
||||||
if (targetComment.isEditTextarea) return;
|
if (currentPasswordCommentId.value === comment.commentId) {
|
||||||
toggleCommentPassword(comment, "edit");
|
// 이미 비밀번호 입력 중이면 유지
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
// 다른 모든 댓글의 수정창 닫기
|
||||||
|
closeAllEditTextareas();
|
||||||
|
|
||||||
|
// 비밀번호 입력
|
||||||
|
targetComment.isEditTextarea = false;
|
||||||
|
toggleCommentPassword(comment, "edit");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
alert("수정이 불가능합니다");
|
alert("수정이 불가능합니다");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 모든 댓글의 수정 창 닫기
|
||||||
|
const closeAllEditTextareas = () => {
|
||||||
|
comments.value.forEach(comment => {
|
||||||
|
comment.isEditTextarea = false;
|
||||||
|
comment.children.forEach(reply => {
|
||||||
|
reply.isEditTextarea = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// 댓글 삭제 버튼 클릭
|
// 댓글 삭제 버튼 클릭
|
||||||
const deleteComment = async (comment) => {
|
const deleteComment = async (comment) => {
|
||||||
const isMyComment = comment.authorId === currentUserId.value;
|
const isMyComment = comment.authorId === currentUserId.value;
|
||||||
@ -587,7 +615,9 @@ const submitCommentPassword = async (comment, password) => {
|
|||||||
if (lastCommentClickedButton.value === "edit") {
|
if (lastCommentClickedButton.value === "edit") {
|
||||||
|
|
||||||
if (targetComment) {
|
if (targetComment) {
|
||||||
//여기서 input 창 닫혀야함
|
// 다른 모든 댓글의 수정 창 닫기
|
||||||
|
closeAllEditTextareas();
|
||||||
|
|
||||||
targetComment.isEditTextarea = true;
|
targetComment.isEditTextarea = true;
|
||||||
passwordCommentAlert.value = "";
|
passwordCommentAlert.value = "";
|
||||||
currentPasswordCommentId.value = null;
|
currentPasswordCommentId.value = null;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user