mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-22 02:41:25 +00:00
Enforce required validation on signup answers (#2865)
This commit is contained in:
parent
6e04efab2d
commit
634c901262
2 changed files with 14 additions and 8 deletions
|
@ -4,6 +4,7 @@ import autosize from "autosize";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { NoOptionI18nKeys } from "i18next";
|
import { NoOptionI18nKeys } from "i18next";
|
||||||
import { Component, linkEvent } from "inferno";
|
import { Component, linkEvent } from "inferno";
|
||||||
|
import { createElement } from "inferno-create-element";
|
||||||
import { Prompt } from "inferno-router";
|
import { Prompt } from "inferno-router";
|
||||||
import { Language } from "lemmy-js-client";
|
import { Language } from "lemmy-js-client";
|
||||||
import {
|
import {
|
||||||
|
@ -52,6 +53,7 @@ interface MarkdownTextAreaProps {
|
||||||
onSubmit?(content: string, languageId?: number): Promise<boolean>;
|
onSubmit?(content: string, languageId?: number): Promise<boolean>;
|
||||||
allLanguages: Language[]; // TODO should probably be nullable
|
allLanguages: Language[]; // TODO should probably be nullable
|
||||||
siteLanguages: number[]; // TODO same
|
siteLanguages: number[]; // TODO same
|
||||||
|
renderAsDiv?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImageUploadStatus {
|
interface ImageUploadStatus {
|
||||||
|
@ -114,13 +116,16 @@ export class MarkdownTextArea extends Component<
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const languageId = this.state.languageId;
|
const languageId = this.state.languageId;
|
||||||
|
return createElement(
|
||||||
return (
|
this.props.renderAsDiv ? "div" : "form",
|
||||||
<form
|
{
|
||||||
className="markdown-textarea"
|
className: "markdown-textarea",
|
||||||
id={this.formId}
|
id: this.formId,
|
||||||
onSubmit={linkEvent(this, this.handleSubmit)}
|
onSubmit: this.props.renderAsDiv
|
||||||
>
|
? undefined
|
||||||
|
: linkEvent(this, this.handleSubmit),
|
||||||
|
},
|
||||||
|
<>
|
||||||
<Prompt
|
<Prompt
|
||||||
message={I18NextService.i18n.t("block_leaving")}
|
message={I18NextService.i18n.t("block_leaving")}
|
||||||
when={
|
when={
|
||||||
|
@ -306,7 +311,7 @@ export class MarkdownTextArea extends Component<
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -303,6 +303,7 @@ export class Signup extends Component<SignupRouteProps, State> {
|
||||||
hideNavigationWarnings
|
hideNavigationWarnings
|
||||||
allLanguages={[]}
|
allLanguages={[]}
|
||||||
siteLanguages={[]}
|
siteLanguages={[]}
|
||||||
|
renderAsDiv={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue