diff options
author | Dessalines <tyhou13@gmx.com> | 2020-03-06 14:57:52 -0500 |
---|---|---|
committer | Dessalines <tyhou13@gmx.com> | 2020-03-06 14:57:52 -0500 |
commit | a67a69f95e268a679a6c42722240628019355790 (patch) | |
tree | 5e7334cb89e4e69d547e90ccba7864bd0f62fc19 /ui/src/components/comment-form.tsx | |
parent | 0708a6d665ef81700ac61c32f1c3710db9493108 (diff) |
Ask for confirmation on leaving pages with incomplete forms. Fixes #529
Diffstat (limited to 'ui/src/components/comment-form.tsx')
-rw-r--r-- | ui/src/components/comment-form.tsx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ui/src/components/comment-form.tsx b/ui/src/components/comment-form.tsx index aa8e651d..f3009d34 100644 --- a/ui/src/components/comment-form.tsx +++ b/ui/src/components/comment-form.tsx @@ -1,4 +1,5 @@ import { Component, linkEvent } from 'inferno'; +import { Prompt } from 'inferno-router'; import { CommentNode as CommentNodeI, CommentForm as CommentFormI, @@ -87,6 +88,10 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> { render() { return ( <div class="mb-3"> + <Prompt + when={this.state.commentForm.content} + message={i18n.t('block_leaving')} + /> <form onSubmit={linkEvent(this, this.handleCommentSubmit)}> <div class="form-group row"> <div className={`col-sm-12`}> |