Adjust editor config (#976)

* Adjust editor config

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
Co-authored-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Tilman Vatteroth 2021-02-03 22:13:04 +01:00 committed by GitHub
parent 0180c75e55
commit e12dc523f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
301 changed files with 4393 additions and 3741 deletions

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { LanguagePicker } from './language-picker'

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import { Settings } from 'luxon'
import React, { useCallback } from 'react'
@ -41,9 +41,11 @@ const languages = {
}
const findLanguageCode = (wantedLanguage: string): string => {
let foundLanguage = Object.keys(languages).find((supportedLanguage) => wantedLanguage === supportedLanguage)
let foundLanguage = Object.keys(languages)
.find((supportedLanguage) => wantedLanguage === supportedLanguage)
if (!foundLanguage) {
foundLanguage = Object.keys(languages).find((supportedLanguage) => wantedLanguage.substr(0, 2) === supportedLanguage)
foundLanguage = Object.keys(languages)
.find((supportedLanguage) => wantedLanguage.substr(0, 2) === supportedLanguage)
}
return foundLanguage || ''
}
@ -62,13 +64,14 @@ const LanguagePicker: React.FC = () => {
as="select"
size="sm"
className="mb-2 mx-auto w-auto"
value={findLanguageCode(i18n.language)}
onChange={onChangeLang()}
value={ findLanguageCode(i18n.language) }
onChange={ onChangeLang() }
>
{
Object.entries(languages).map(([language, languageName]) => {
return <option key={language} value={language}>{languageName}</option>
})
Object.entries(languages)
.map(([language, languageName]) => {
return <option key={ language } value={ language }>{ languageName }</option>
})
}
</Form.Control>
)

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { Fragment } from 'react'
import { Trans, useTranslation } from 'react-i18next'
@ -22,15 +22,15 @@ export const PoweredByLinks: React.FC = () => {
return (
<p>
<Trans i18nKey="landing.footer.poweredBy">
<ExternalLink href={links.webpage} text="HedgeDoc"/>
<ExternalLink href={ links.webpage } text="HedgeDoc"/>
</Trans>
&nbsp;|&nbsp;
<TranslatedInternalLink href='/n/release-notes' i18nKey='landing.footer.releases'/>
{
specialLinks.map(([i18nKey, href]) =>
<Fragment key={i18nKey}>
<Fragment key={ i18nKey }>
&nbsp;|&nbsp;
<TranslatedExternalLink href={href} i18nKey={'landing.footer.' + i18nKey}/>
<TranslatedExternalLink href={ href } i18nKey={ 'landing.footer.' + i18nKey }/>
</Fragment>
)
}

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { Trans, useTranslation } from 'react-i18next'
@ -13,13 +13,13 @@ const SocialLink: React.FC = () => {
useTranslation()
return (
<p>
<Trans i18nKey="landing.footer.followUs" components={[
<ExternalLink href={links.githubOrg} icon='github' text="GitHub"/>,
<ExternalLink href={links.community} icon='users' text="Discourse"/>,
<ExternalLink href={links.chat} icon="comment" text="Matrix"/>,
<ExternalLink href={links.mastodon} icon='mastodon' text="Mastodon"/>,
<ExternalLink href={links.translate} icon="globe" text="POEditor"/>
]}/>
<Trans i18nKey="landing.footer.followUs" components={ [
<ExternalLink href={ links.githubOrg } icon='github' text="GitHub"/>,
<ExternalLink href={ links.community } icon='users' text="Discourse"/>,
<ExternalLink href={ links.chat } icon="comment" text="Matrix"/>,
<ExternalLink href={ links.mastodon } icon='mastodon' text="Mastodon"/>,
<ExternalLink href={ links.translate } icon="globe" text="POEditor"/>
] }/>
</p>
)
}

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import equal from 'fast-deep-equal'
import React, { Fragment, useState } from 'react'
@ -27,34 +27,36 @@ export const VersionInfo: React.FC = () => {
const serverVersion = useSelector((state: ApplicationState) => state.config.version, equal)
const column = (title: string, version: string, sourceCodeLink: string, issueTrackerLink: string) => (
<Col md={6} className={'flex-column'}>
<h5>{title}</h5>
<CopyableField content={version}/>
<ShowIf condition={!!sourceCodeLink}>
<TranslatedExternalLink i18nKey={'landing.versionInfo.sourceCode'} className={'btn btn-sm btn-primary d-block mb-2'} href={sourceCodeLink}/>
<Col md={ 6 } className={ 'flex-column' }>
<h5>{ title }</h5>
<CopyableField content={ version }/>
<ShowIf condition={ !!sourceCodeLink }>
<TranslatedExternalLink i18nKey={ 'landing.versionInfo.sourceCode' }
className={ 'btn btn-sm btn-primary d-block mb-2' } href={ sourceCodeLink }/>
</ShowIf>
<ShowIf condition={!!issueTrackerLink}>
<TranslatedExternalLink i18nKey={'landing.versionInfo.issueTracker'} className={'btn btn-sm btn-primary d-block mb-2'} href={issueTrackerLink}/>
<ShowIf condition={ !!issueTrackerLink }>
<TranslatedExternalLink i18nKey={ 'landing.versionInfo.issueTracker' }
className={ 'btn btn-sm btn-primary d-block mb-2' } href={ issueTrackerLink }/>
</ShowIf>
</Col>
)
return (
<Fragment>
<Link id='version' to={'#'} className={'text-light'} onClick={handleShow}>
<Trans i18nKey={'landing.versionInfo.versionInfo'}/>
<Link id='version' to={ '#' } className={ 'text-light' } onClick={ handleShow }>
<Trans i18nKey={ 'landing.versionInfo.versionInfo' }/>
</Link>
<Modal id='versionModal' show={show} onHide={handleClose} animation={true}>
<Modal id='versionModal' show={ show } onHide={ handleClose } animation={ true }>
<Modal.Body className="text-dark">
<h3><Trans i18nKey={'landing.versionInfo.title'}/></h3>
<h3><Trans i18nKey={ 'landing.versionInfo.title' }/></h3>
<Row>
{column(t('landing.versionInfo.serverVersion'), serverVersion.version, serverVersion.sourceCodeUrl, serverVersion.issueTrackerUrl)}
{column(t('landing.versionInfo.clientVersion'), frontendVersion.version, frontendVersion.sourceCodeUrl, frontendVersion.issueTrackerUrl)}
{ column(t('landing.versionInfo.serverVersion'), serverVersion.version, serverVersion.sourceCodeUrl, serverVersion.issueTrackerUrl) }
{ column(t('landing.versionInfo.clientVersion'), frontendVersion.version, frontendVersion.sourceCodeUrl, frontendVersion.issueTrackerUrl) }
</Row>
</Modal.Body>
<Modal.Footer>
<Button variant="secondary" onClick={handleClose}>
<Trans i18nKey={'common.close'}/>
<Button variant="secondary" onClick={ handleClose }>
<Trans i18nKey={ 'common.close' }/>
</Button>
</Modal.Footer>
</Modal>

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { Container } from 'react-bootstrap'
@ -18,9 +18,9 @@ export const LandingLayout: React.FC = ({ children }) => {
<Container className="text-light d-flex flex-column mvh-100">
<MotdBanner/>
<HeaderBar/>
<div className={'d-flex flex-column justify-content-between flex-fill text-center'}>
<div className={ 'd-flex flex-column justify-content-between flex-fill text-center' }>
<div>
{children}
{ children }
</div>
<Footer/>
</div>

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React, { Fragment } from 'react'
import { Navbar } from 'react-bootstrap'
@ -31,19 +31,19 @@ const HeaderBar: React.FC = () => {
</HeaderNavLink>
</div>
<div className="d-inline-flex">
{!userExists
{ !userExists
? <Fragment>
<span className={'mx-1 d-flex'}>
<span className={ 'mx-1 d-flex' }>
<NewGuestNoteButton/>
</span>
<SignInButton size="sm"/>
</Fragment>
<SignInButton size="sm"/>
</Fragment>
: <Fragment>
<span className={'mx-1 d-flex'}>
<span className={ 'mx-1 d-flex' }>
<NewUserNoteButton/>
</span>
<UserDropdown/>
</Fragment>
<UserDropdown/>
</Fragment>
}
</div>
</Navbar>

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { Nav } from 'react-bootstrap'
@ -16,8 +16,8 @@ export interface HeaderNavLinkProps {
export const HeaderNavLink: React.FC<HeaderNavLinkProps> = ({ to, id, children }) => {
return (
<Nav.Item>
<LinkContainer to={to}>
<Nav.Link id={id} className="text-light" href={to}>{children}</Nav.Link>
<LinkContainer to={ to }>
<Nav.Link id={ id } className="text-light" href={ to }>{ children }</Nav.Link>
</LinkContainer>
</Nav.Item>
)

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { Button } from 'react-bootstrap'
@ -13,7 +13,7 @@ import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
export const NewGuestNoteButton: React.FC = () => {
const { t } = useTranslation()
return (
<LinkContainer to={'/new'} title={t('landing.navigation.newGuestNote')}>
<LinkContainer to={ '/new' } title={ t('landing.navigation.newGuestNote') }>
<Button
variant="primary"
size="sm"

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { Button } from 'react-bootstrap'
@ -13,7 +13,7 @@ import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
export const NewUserNoteButton: React.FC = () => {
const { t } = useTranslation()
return (
<LinkContainer to={'/new'} title={t('landing.navigation.newNote')}>
<LinkContainer to={ '/new' } title={ t('landing.navigation.newNote') }>
<Button
variant="primary"
size="sm"

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import React from 'react'
import { Button } from 'react-bootstrap'
@ -14,18 +14,19 @@ import { ApplicationState } from '../../../redux'
import { ShowIf } from '../../common/show-if/show-if'
type SignInButtonProps = {
className?: string
} & Omit<ButtonProps, 'href'>
className?: string
} & Omit<ButtonProps, 'href'>
export const SignInButton: React.FC<SignInButtonProps> = ({ variant, ...props }) => {
const { t } = useTranslation()
const anyAuthProviderActive = useSelector((state: ApplicationState) => Object.values(state.config.authProviders).includes(true))
const anyAuthProviderActive = useSelector((state: ApplicationState) => Object.values(state.config.authProviders)
.includes(true))
return (
<ShowIf condition={anyAuthProviderActive}>
<LinkContainer to="/login" title={t('login.signIn')}>
<ShowIf condition={ anyAuthProviderActive }>
<LinkContainer to="/login" title={ t('login.signIn') }>
<Button
variant={variant || 'success'}
{...props}
variant={ variant || 'success' }
{ ...props }
>
<Trans i18nKey="login.signIn"/>
</Button>

View file

@ -1,8 +1,8 @@
/*
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
SPDX-License-Identifier: AGPL-3.0-only
*/
SPDX-License-Identifier: AGPL-3.0-only
*/
import equal from 'fast-deep-equal'
import React from 'react'
@ -25,28 +25,28 @@ export const UserDropdown: React.FC = () => {
return (
<Dropdown alignRight>
<Dropdown.Toggle size="sm" variant="dark" id="dropdown-user" className={'d-flex align-items-center'}>
<UserAvatar name={user.name} photo={user.photo}/>
<Dropdown.Toggle size="sm" variant="dark" id="dropdown-user" className={ 'd-flex align-items-center' }>
<UserAvatar name={ user.name } photo={ user.photo }/>
</Dropdown.Toggle>
<Dropdown.Menu className='text-start'>
<LinkContainer to={'/n/features'}>
<LinkContainer to={ '/n/features' }>
<Dropdown.Item dir='auto'>
<ForkAwesomeIcon icon="bolt" fixedWidth={true} className="mx-2"/>
<ForkAwesomeIcon icon="bolt" fixedWidth={ true } className="mx-2"/>
<Trans i18nKey="editor.help.documents.features"/>
</Dropdown.Item>
</LinkContainer>
<LinkContainer to={'/profile'}>
<LinkContainer to={ '/profile' }>
<Dropdown.Item dir='auto'>
<ForkAwesomeIcon icon="user" fixedWidth={true} className="mx-2"/>
<ForkAwesomeIcon icon="user" fixedWidth={ true } className="mx-2"/>
<Trans i18nKey="profile.userProfile"/>
</Dropdown.Item>
</LinkContainer>
<Dropdown.Item dir='auto'
onClick={() => {
clearUser()
}}>
<ForkAwesomeIcon icon="sign-out" fixedWidth={true} className="mx-2"/>
onClick={ () => {
clearUser()
} }>
<ForkAwesomeIcon icon="sign-out" fixedWidth={ true } className="mx-2"/>
<Trans i18nKey="login.signOut"/>
</Dropdown.Item>
</Dropdown.Menu>