mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-29 06:15:29 -04:00
Update multiple packages (#719)
* Update multiple packages - @typescript-eslint/eslint-plugin - @typescript-eslint/parser - eslint-config-react-app - eslint-config-standard - react-scripts Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * fix type Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * deduplicate code Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * Disable test because it doesn't work Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * repair service worker Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * Lazy load mermaid Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * use show error Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * fix tsconfig in cypress Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de> * fix import integration test Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
0c222fae64
commit
460badb97b
21 changed files with 4468 additions and 5286 deletions
|
@ -15,15 +15,15 @@ export const Branding: React.FC<BrandingProps> = ({ inline = false }) => {
|
|||
|
||||
return (
|
||||
<ShowIf condition={showBranding}>
|
||||
<strong className={`mx-1 ${inline ? 'inline-size' : 'regular-size'}`} >@</strong>
|
||||
<strong className={`mx-1 ${inline ? 'inline-size' : 'regular-size'}`}>@</strong>
|
||||
{
|
||||
branding.logo
|
||||
? <img
|
||||
src={branding.logo}
|
||||
alt={branding.name}
|
||||
title={branding.name}
|
||||
className={inline ? 'inline-size' : 'regular-size'}
|
||||
/>
|
||||
src={branding.logo}
|
||||
alt={branding.name}
|
||||
title={branding.name}
|
||||
className={inline ? 'inline-size' : 'regular-size'}
|
||||
/>
|
||||
: branding.name
|
||||
}
|
||||
</ShowIf>
|
||||
|
|
|
@ -2,11 +2,11 @@ import React from 'react'
|
|||
import { Trans } from 'react-i18next'
|
||||
import { IconButton, IconButtonProps } from './icon-button'
|
||||
|
||||
export interface TranslatedIconButton extends IconButtonProps {
|
||||
export interface TranslatedIconButtonProps extends IconButtonProps {
|
||||
i18nKey: string
|
||||
}
|
||||
|
||||
export const TranslatedIconButton: React.FC<TranslatedIconButton> = ({ i18nKey, ...props }) => {
|
||||
export const TranslatedIconButton: React.FC<TranslatedIconButtonProps> = ({ i18nKey, ...props }) => {
|
||||
return (
|
||||
<IconButton {...props}>
|
||||
<Trans i18nKey={i18nKey}/>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import React from 'react'
|
||||
import { DateTime } from 'luxon'
|
||||
import React from 'react'
|
||||
import { ListGroup } from 'react-bootstrap'
|
||||
import { Trans } from 'react-i18next'
|
||||
import { RevisionListEntry } from '../../../../api/revisions/types'
|
||||
|
@ -32,11 +32,11 @@ export const RevisionModalListEntry: React.FC<RevisionModalListEntryProps> = ({
|
|||
<span className={'d-flex flex-row my-1 align-items-center'}>
|
||||
<ForkAwesomeIcon icon={'user-o'} className={'mx-2'}/>
|
||||
{
|
||||
revisionAuthorListMap.get(revision.timestamp)?.map((user, index) => {
|
||||
return (
|
||||
<UserAvatar name={user.name} photo={user.photo} showName={false} additionalClasses={'mx-1'} key={index}/>
|
||||
)
|
||||
})
|
||||
revisionAuthorListMap.get(revision.timestamp)?.map((user, index) => {
|
||||
return (
|
||||
<UserAvatar name={user.name} photo={user.photo} showName={false} additionalClasses={'mx-1'} key={index}/>
|
||||
)
|
||||
})
|
||||
}
|
||||
</span>
|
||||
</ListGroup.Item>
|
||||
|
|
|
@ -61,32 +61,34 @@ const tab = (editor: Editor) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const defaultKeyMap: KeyMap = !isMac ? {
|
||||
F10: f10,
|
||||
Esc: esc,
|
||||
'Ctrl-S': suppressSave,
|
||||
Enter: 'newlineAndIndentContinueMarkdownList',
|
||||
Tab: tab,
|
||||
Home: 'goLineLeftSmart',
|
||||
End: 'goLineRight',
|
||||
'Ctrl-I': makeSelectionItalic,
|
||||
'Ctrl-B': makeSelectionBold,
|
||||
'Ctrl-U': underlineSelection,
|
||||
'Ctrl-D': strikeThroughSelection,
|
||||
'Ctrl-M': markSelection
|
||||
} : {
|
||||
F10: f10,
|
||||
Esc: esc,
|
||||
'Cmd-S': suppressSave,
|
||||
Enter: 'newlineAndIndentContinueMarkdownList',
|
||||
Tab: tab,
|
||||
'Cmd-Left': 'goLineLeftSmart',
|
||||
'Cmd-Right': 'goLineRight',
|
||||
Home: 'goLineLeftSmart',
|
||||
End: 'goLineRight',
|
||||
'Cmd-I': makeSelectionItalic,
|
||||
'Cmd-B': makeSelectionBold,
|
||||
'Cmd-U': underlineSelection,
|
||||
'Cmd-D': strikeThroughSelection,
|
||||
'Cmd-M': markSelection
|
||||
}
|
||||
export const defaultKeyMap: KeyMap = !isMac
|
||||
? {
|
||||
F10: f10,
|
||||
Esc: esc,
|
||||
'Ctrl-S': suppressSave,
|
||||
Enter: 'newlineAndIndentContinueMarkdownList',
|
||||
Tab: tab,
|
||||
Home: 'goLineLeftSmart',
|
||||
End: 'goLineRight',
|
||||
'Ctrl-I': makeSelectionItalic,
|
||||
'Ctrl-B': makeSelectionBold,
|
||||
'Ctrl-U': underlineSelection,
|
||||
'Ctrl-D': strikeThroughSelection,
|
||||
'Ctrl-M': markSelection
|
||||
}
|
||||
: {
|
||||
F10: f10,
|
||||
Esc: esc,
|
||||
'Cmd-S': suppressSave,
|
||||
Enter: 'newlineAndIndentContinueMarkdownList',
|
||||
Tab: tab,
|
||||
'Cmd-Left': 'goLineLeftSmart',
|
||||
'Cmd-Right': 'goLineRight',
|
||||
Home: 'goLineLeftSmart',
|
||||
End: 'goLineRight',
|
||||
'Cmd-I': makeSelectionItalic,
|
||||
'Cmd-B': makeSelectionBold,
|
||||
'Cmd-U': underlineSelection,
|
||||
'Cmd-D': strikeThroughSelection,
|
||||
'Cmd-M': markSelection
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,7 @@ export interface RawYAMLMetadata {
|
|||
disqus: string | undefined
|
||||
type: string | undefined
|
||||
slideOptions: unknown
|
||||
opengraph: { [key: string]:string }
|
||||
opengraph: { [key: string]:string } | null
|
||||
}
|
||||
|
||||
export class YAMLMetaData {
|
||||
|
|
|
@ -50,16 +50,16 @@ export const HistoryContent: React.FC<HistoryContentProps> = ({ viewState, entri
|
|||
|
||||
const mapViewStateToComponent = (viewState: ViewStateEnum) => {
|
||||
switch (viewState) {
|
||||
default:
|
||||
case ViewStateEnum.CARD:
|
||||
return <HistoryCardList entries={entries}
|
||||
case ViewStateEnum.TABLE:
|
||||
return <HistoryTable entries={entries}
|
||||
onPinClick={onPinClick}
|
||||
onRemoveClick={onRemoveClick}
|
||||
onDeleteClick={onDeleteClick}
|
||||
pageIndex={pageIndex}
|
||||
onLastPageIndexChange={setLastPageIndex}/>
|
||||
case ViewStateEnum.TABLE:
|
||||
return <HistoryTable entries={entries}
|
||||
case ViewStateEnum.CARD:
|
||||
default:
|
||||
return <HistoryCardList entries={entries}
|
||||
onPinClick={onPinClick}
|
||||
onRemoveClick={onRemoveClick}
|
||||
onDeleteClick={onDeleteClick}
|
||||
|
|
|
@ -11,13 +11,14 @@ export enum SortModeEnum {
|
|||
|
||||
const getIcon = (direction: SortModeEnum): IconName => {
|
||||
switch (direction) {
|
||||
default:
|
||||
case SortModeEnum.no:
|
||||
return 'sort'
|
||||
case SortModeEnum.up:
|
||||
return 'sort-asc'
|
||||
case SortModeEnum.down:
|
||||
return 'sort-desc'
|
||||
default:
|
||||
return 'sort'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,8 +33,8 @@ const toggleDirection = (direction: SortModeEnum) => {
|
|||
return SortModeEnum.up
|
||||
case SortModeEnum.up:
|
||||
return SortModeEnum.down
|
||||
default:
|
||||
case SortModeEnum.down:
|
||||
default:
|
||||
return SortModeEnum.no
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,17 +27,17 @@ const HeaderBar: React.FC = () => {
|
|||
<div className="d-inline-flex">
|
||||
{!userExists
|
||||
? <Fragment>
|
||||
<span className={'mx-1 d-flex'}>
|
||||
<NewGuestNoteButton/>
|
||||
</span>
|
||||
<SignInButton size="sm"/>
|
||||
</Fragment>
|
||||
<span className={'mx-1 d-flex'}>
|
||||
<NewGuestNoteButton/>
|
||||
</span>
|
||||
<SignInButton size="sm"/>
|
||||
</Fragment>
|
||||
: <Fragment>
|
||||
<span className={'mx-1 d-flex'}>
|
||||
<NewUserNoteButton/>
|
||||
</span>
|
||||
<UserDropdown/>
|
||||
</Fragment>
|
||||
<span className={'mx-1 d-flex'}>
|
||||
<NewUserNoteButton/>
|
||||
</span>
|
||||
<UserDropdown/>
|
||||
</Fragment>
|
||||
}
|
||||
</div>
|
||||
</Navbar>
|
||||
|
|
|
@ -39,10 +39,12 @@ export class FullMarkdownItConfigurator extends BasicMarkdownItConfigurator {
|
|||
tasksLists,
|
||||
(markdownIt) => {
|
||||
frontmatterExtract(markdownIt,
|
||||
!this.useFrontmatter ? undefined : {
|
||||
onYamlError: (error: boolean) => this.onYamlError(error),
|
||||
onRawMeta: (rawMeta: RawYAMLMetadata) => this.onRawMeta(rawMeta)
|
||||
})
|
||||
!this.useFrontmatter
|
||||
? undefined
|
||||
: {
|
||||
onYamlError: (error: boolean) => this.onYamlError(error),
|
||||
onRawMeta: (rawMeta: RawYAMLMetadata) => this.onRawMeta(rawMeta)
|
||||
})
|
||||
},
|
||||
headlineAnchors,
|
||||
KatexReplacer.markdownItPlugin,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import mermaid from 'mermaid'
|
||||
import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { Alert } from 'react-bootstrap'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
@ -22,30 +21,37 @@ export const MermaidChart: React.FC<MermaidChartProps> = ({ code }) => {
|
|||
|
||||
useEffect(() => {
|
||||
if (!mermaidInitialized) {
|
||||
mermaid.initialize({ startOnLoad: false })
|
||||
mermaidInitialized = true
|
||||
import('mermaid').then((mermaid) => {
|
||||
mermaid.default.initialize({ startOnLoad: false })
|
||||
mermaidInitialized = true
|
||||
}).catch(() => { console.error('error while loading mermaid') })
|
||||
}
|
||||
}, [])
|
||||
|
||||
const showError = useCallback((error: string) => {
|
||||
setError(error)
|
||||
console.error(error)
|
||||
if (!diagramContainer.current) {
|
||||
return
|
||||
}
|
||||
setError(error)
|
||||
console.error(error)
|
||||
diagramContainer.current.querySelectorAll('svg').forEach(child => child.remove())
|
||||
}, [])
|
||||
}, [setError])
|
||||
|
||||
useEffect(() => {
|
||||
if (!diagramContainer.current) {
|
||||
return
|
||||
}
|
||||
try {
|
||||
mermaid.parse(code)
|
||||
delete diagramContainer.current.dataset.processed
|
||||
diagramContainer.current.textContent = code
|
||||
mermaid.init(diagramContainer.current)
|
||||
setError(undefined)
|
||||
import('mermaid').then((mermaid) => {
|
||||
if (!diagramContainer.current) {
|
||||
return
|
||||
}
|
||||
mermaid.default.parse(code)
|
||||
delete diagramContainer.current.dataset.processed
|
||||
diagramContainer.current.textContent = code
|
||||
mermaid.default.init(diagramContainer.current)
|
||||
setError(undefined)
|
||||
}).catch(() => showError('Error while loading mermaid'))
|
||||
} catch (error) {
|
||||
const message = (error as MermaidParseError).str
|
||||
showError(message || t('renderer.mermaid.unknownError'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue