수정버튼 누르면 초기화

This commit is contained in:
kimdaae328 2025-02-28 14:12:33 +09:00
parent c68e8839b3
commit 86a6e5b27b

View File

@ -473,16 +473,44 @@ const editComment = (comment) => {
const isAnonymous = comment.author === "익명";
if (isMyComment) {
targetComment.isEditTextarea = !targetComment.isEditTextarea;
lastCommentClickedButton.value = "edit";
if (targetComment.isEditTextarea) {
//
targetComment.isEditTextarea = false;
currentPasswordCommentId.value = comment.commentId;
} else {
//
closeAllEditTextareas();
//
targetComment.isEditTextarea = true;
}
} else if (isAnonymous) {
if (targetComment.isEditTextarea) return;
toggleCommentPassword(comment, "edit");
if (currentPasswordCommentId.value === comment.commentId) {
//
return;
} else {
//
closeAllEditTextareas();
//
targetComment.isEditTextarea = false;
toggleCommentPassword(comment, "edit");
}
} else {
alert("수정이 불가능합니다");
}
}
//
const closeAllEditTextareas = () => {
comments.value.forEach(comment => {
comment.isEditTextarea = false;
comment.children.forEach(reply => {
reply.isEditTextarea = false;
});
});
};
//
const deleteComment = async (comment) => {
const isMyComment = comment.authorId === currentUserId.value;
@ -587,7 +615,9 @@ const submitCommentPassword = async (comment, password) => {
if (lastCommentClickedButton.value === "edit") {
if (targetComment) {
// input
//
closeAllEditTextareas();
targetComment.isEditTextarea = true;
passwordCommentAlert.value = "";
currentPasswordCommentId.value = null;