mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
fix(cheatsheet): refactor cheatsheet to use app extensions as source
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
9d49401b4d
commit
24b0070909
53 changed files with 1164 additions and 275 deletions
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2023 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import type React from 'react'
|
||||
|
||||
export interface CheatsheetExtensionComponentProps {
|
||||
setContent: (dispatcher: string | ((prevState: string) => string)) => void
|
||||
}
|
||||
|
||||
export type CheatsheetExtension = CheatsheetEntry | CheatsheetGroup
|
||||
|
||||
export const isCheatsheetGroup = (extension: CheatsheetExtension | undefined): extension is CheatsheetGroup => {
|
||||
return (extension as CheatsheetGroup)?.entries !== undefined
|
||||
}
|
||||
|
||||
export interface CheatsheetGroup {
|
||||
i18nKey: string
|
||||
categoryI18nKey?: string
|
||||
entries: CheatsheetEntry[]
|
||||
}
|
||||
|
||||
export interface CheatsheetEntry {
|
||||
i18nKey: string
|
||||
categoryI18nKey?: string
|
||||
cheatsheetExtensionComponent?: React.FC<CheatsheetExtensionComponentProps>
|
||||
|
||||
readMoreUrl?: URL
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue