Renders the form of a dump's comment thread that posts a comment or a
reply. An edit opens InlineEditField in the comment's place.
Renders a comment editor and its submit button, disabled while the text is
blank or longer than VALIDATION.COMMENT_BODY_MAX.
Passed to CommentForm by CommentThread, for a new comment, and by
CommentNode, for a reply.
-
cancelWhenEmpty: boolean
Shows Cancel only once there is text to throw away, and doesn't cancel on Escape. For the new-comment form, which has nothing to close.
-
className: string
Applies to the
inlinelayout only. - editorRef: React.Ref<TextEditorHandle>
- errorTitle: string
-
layout: "inline" | "top"
topputsleadingbeside the editor, for the new-comment form.inlineis for replies, inside a comment. - leading: React.ReactNode
-
onCancel: () => void
Without it, the form has no Cancel button.
-
onSubmit: (body: string) => Promise<void>
Sends the text. The form empties itself once it resolves. When it throws, as
expectOkdoes, the form keeps the text and shows the error undererrorTitle. - pendingLabel: React.ReactNode
- placeholder: string
- submitLabel: React.ReactNode
Usage
import * as mod from "src/components/comment/CommentForm.tsx";