feat: 更新评论输入框的占位符,支持自定义占位符文本
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 27s

This commit is contained in:
2025-09-12 16:27:12 +08:00
parent 0a7cbc00fc
commit 3fdd801d28
3 changed files with 132 additions and 129 deletions

View File

@ -16,12 +16,14 @@ export function CommentInput(
onCommentSubmitted,
initContent = "",
initIsPrivate = false,
placeholder = "",
isUpdate = false
}: {
user: User | null,
onCommentSubmitted: ({ commentContent, isPrivate }: { commentContent: string, isPrivate: boolean }) => void,
initContent?: string,
initIsPrivate?: boolean,
placeholder?: string,
isUpdate?: boolean,
}
) {
@ -65,7 +67,7 @@ export function CommentInput(
</div>
<div className="flex-1 pl-2 fade-in-up">
<Textarea
placeholder={user ? (isPrivate ? t("private_placeholder") : t("placeholder")) : t("login_required", { loginButton: "登录" })}
placeholder={placeholder || (user ? (isPrivate ? t("private_placeholder") : t("placeholder")) : t("login_required", { loginButton: "登录" }))}
className="w-full p-2 border border-gray-300 rounded-md fade-in-up"
value={commentContent}
onChange={(e) => setCommentContent(e.target.value)}

View File

@ -268,6 +268,7 @@ export function CommentItem(
user={user}
onCommentSubmitted={onReply}
initIsPrivate={isPrivate}
placeholder={`${t("reply")} ${comment.user.nickname} :`}
/>}
{activeInput && activeInput.type === 'edit' && activeInput.id === comment.id && <CommentInput
user={user}