mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-23 11:21:26 +00:00
more cleanup
This commit is contained in:
parent
e164a3b9a1
commit
8fcde4bdd0
3 changed files with 54 additions and 51 deletions
|
@ -4,6 +4,7 @@ import { Helmet } from "inferno-helmet";
|
|||
import { httpExternalPath } from "../../env";
|
||||
import { i18n } from "../../i18next";
|
||||
import { md } from "../../utils";
|
||||
|
||||
interface HtmlTagsProps {
|
||||
title: string;
|
||||
path: string;
|
||||
|
|
|
@ -184,53 +184,6 @@ export class MarkdownTextArea extends Component<
|
|||
</div>
|
||||
<div className="row">
|
||||
<div className="col-sm-12 d-flex flex-wrap">
|
||||
{this.props.buttonTitle && (
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-sm btn-secondary mr-2"
|
||||
disabled={this.isDisabled}
|
||||
>
|
||||
{this.state.loading ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
<span>{this.props.buttonTitle}</span>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
{this.props.replyType && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm btn-secondary mr-2"
|
||||
onClick={linkEvent(this, this.handleReplyCancel)}
|
||||
>
|
||||
{i18n.t("cancel")}
|
||||
</button>
|
||||
)}
|
||||
{this.state.content && (
|
||||
<button
|
||||
className={`btn btn-sm btn-secondary mr-2 ${
|
||||
this.state.previewMode && "active"
|
||||
}`}
|
||||
onClick={linkEvent(this, this.handlePreviewToggle)}
|
||||
>
|
||||
{this.state.previewMode ? i18n.t("edit") : i18n.t("preview")}
|
||||
</button>
|
||||
)}
|
||||
{/* A flex expander */}
|
||||
<div className="flex-grow-1"></div>
|
||||
|
||||
{this.props.showLanguage && (
|
||||
<LanguageSelect
|
||||
iconVersion
|
||||
allLanguages={this.props.allLanguages}
|
||||
selectedLanguageIds={
|
||||
languageId ? Array.of(languageId) : undefined
|
||||
}
|
||||
siteLanguages={this.props.siteLanguages}
|
||||
onChange={this.handleLanguageChange}
|
||||
disabled={this.isDisabled}
|
||||
/>
|
||||
)}
|
||||
{this.getFormatButton("bold", this.handleInsertBold)}
|
||||
{this.getFormatButton("italic", this.handleInsertItalic)}
|
||||
{this.getFormatButton("link", this.handleInsertLink)}
|
||||
|
@ -283,6 +236,57 @@ export class MarkdownTextArea extends Component<
|
|||
<Icon icon="help-circle" classes="icon-inline" />
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div className="col-sm-12 d-flex align-items-center flex-wrap">
|
||||
{this.props.showLanguage && (
|
||||
<LanguageSelect
|
||||
iconVersion
|
||||
allLanguages={this.props.allLanguages}
|
||||
selectedLanguageIds={
|
||||
languageId ? Array.of(languageId) : undefined
|
||||
}
|
||||
siteLanguages={this.props.siteLanguages}
|
||||
onChange={this.handleLanguageChange}
|
||||
disabled={this.isDisabled}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* A flex expander */}
|
||||
<div className="flex-grow-1"></div>
|
||||
|
||||
{this.props.buttonTitle && (
|
||||
<button
|
||||
type="submit"
|
||||
className="btn btn-sm btn-secondary mr-2"
|
||||
disabled={this.isDisabled}
|
||||
>
|
||||
{this.state.loading ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
<span>{this.props.buttonTitle}</span>
|
||||
)}
|
||||
</button>
|
||||
)}
|
||||
{this.props.replyType && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-sm btn-secondary mr-2"
|
||||
onClick={linkEvent(this, this.handleReplyCancel)}
|
||||
>
|
||||
{i18n.t("cancel")}
|
||||
</button>
|
||||
)}
|
||||
{this.state.content && (
|
||||
<button
|
||||
className={`btn btn-sm btn-secondary mr-2 ${
|
||||
this.state.previewMode && "active"
|
||||
}`}
|
||||
onClick={linkEvent(this, this.handlePreviewToggle)}
|
||||
>
|
||||
{this.state.previewMode ? i18n.t("edit") : i18n.t("preview")}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Component } from "inferno";
|
||||
import moment from "moment";
|
||||
import { i18n } from "../../i18next";
|
||||
import { capitalizeFirstLetter, getLanguages } from "../../utils";
|
||||
import { capitalizeFirstLetter } from "../../utils";
|
||||
import { Icon } from "./icon";
|
||||
|
||||
interface MomentTimeProps {
|
||||
|
@ -15,9 +15,7 @@ export class MomentTime extends Component<MomentTimeProps, any> {
|
|||
constructor(props: any, context: any) {
|
||||
super(props, context);
|
||||
|
||||
const lang = getLanguages();
|
||||
|
||||
moment.locale(lang);
|
||||
moment.locale([...i18n.languages]);
|
||||
}
|
||||
|
||||
createdAndModifiedTimes() {
|
||||
|
|
Loading…
Reference in a new issue