refactor: rename "optional app extensions" into "all app extensions"

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-04-13 18:59:43 +02:00
parent c39561f8e2
commit 0809e01b2d
7 changed files with 13 additions and 13 deletions

View file

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions' import { allAppExtensions } from '../../../../extensions/extra-integrations/all-app-extensions'
import type { CheatsheetEntry, CheatsheetExtension } from '../../cheatsheet/cheatsheet-extension' import type { CheatsheetEntry, CheatsheetExtension } from '../../cheatsheet/cheatsheet-extension'
import { isCheatsheetGroup } from '../../cheatsheet/cheatsheet-extension' import { isCheatsheetGroup } from '../../cheatsheet/cheatsheet-extension'
import { CategoryAccordion } from './category-accordion' import { CategoryAccordion } from './category-accordion'
@ -26,7 +26,7 @@ export const CheatsheetContent: React.FC = () => {
}, []) }, [])
const extensions = useMemo( const extensions = useMemo(
() => optionalAppExtensions.flatMap((extension) => extension.buildCheatsheetExtensions()), () => allAppExtensions.flatMap((extension) => extension.buildCheatsheetExtensions()),
[] []
) )

View file

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions' import { allAppExtensions } from '../../../../extensions/extra-integrations/all-app-extensions'
import type { CheatsheetExtensionComponentProps } from '../../cheatsheet/cheatsheet-extension' import type { CheatsheetExtensionComponentProps } from '../../cheatsheet/cheatsheet-extension'
import { isCheatsheetGroup } from '../../cheatsheet/cheatsheet-extension' import { isCheatsheetGroup } from '../../cheatsheet/cheatsheet-extension'
import type { ReactElement } from 'react' import type { ReactElement } from 'react'
@ -18,7 +18,7 @@ export const useComponentsFromAppExtensions = (
return useMemo(() => { return useMemo(() => {
return ( return (
<Fragment key={'app-extensions'}> <Fragment key={'app-extensions'}>
{optionalAppExtensions {allAppExtensions
.flatMap((extension) => extension.buildCheatsheetExtensions()) .flatMap((extension) => extension.buildCheatsheetExtensions())
.flatMap((extension) => (isCheatsheetGroup(extension) ? extension.entries : extension)) .flatMap((extension) => (isCheatsheetGroup(extension) ? extension.entries : extension))
.map((extension) => { .map((extension) => {

View file

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { optionalAppExtensions } from '../../../../../extensions/extra-integrations/optional-app-extensions' import { allAppExtensions } from '../../../../../extensions/extra-integrations/all-app-extensions'
import { autocompletion } from '@codemirror/autocomplete' import { autocompletion } from '@codemirror/autocomplete'
import type { Extension } from '@codemirror/state' import type { Extension } from '@codemirror/state'
import { useMemo } from 'react' import { useMemo } from 'react'
@ -14,7 +14,7 @@ import { useMemo } from 'react'
export const useCodeMirrorAutocompletionsExtension = (): Extension => { export const useCodeMirrorAutocompletionsExtension = (): Extension => {
return useMemo(() => { return useMemo(() => {
return autocompletion({ return autocompletion({
override: optionalAppExtensions.flatMap((extension) => extension.buildAutocompletion()) override: allAppExtensions.flatMap((extension) => extension.buildAutocompletion())
}) })
}, []) }, [])
} }

View file

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions' import { allAppExtensions } from '../../../../extensions/extra-integrations/all-app-extensions'
import type { ReactElement } from 'react' import type { ReactElement } from 'react'
import React, { Fragment, useMemo } from 'react' import React, { Fragment, useMemo } from 'react'
@ -14,7 +14,7 @@ export const useComponentsFromAppExtensions = (): ReactElement => {
return useMemo(() => { return useMemo(() => {
return ( return (
<Fragment key={'app-extensions'}> <Fragment key={'app-extensions'}>
{optionalAppExtensions.map((extension, index) => {allAppExtensions.map((extension, index) =>
React.createElement(extension.buildEditorExtensionComponent(), { key: index }) React.createElement(extension.buildEditorExtensionComponent(), { key: index })
)} )}
</Fragment> </Fragment>

View file

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { optionalAppExtensions } from '../../../../extensions/extra-integrations/optional-app-extensions' import { allAppExtensions } from '../../../../extensions/extra-integrations/all-app-extensions'
import { useDarkModeState } from '../../../../hooks/common/use-dark-mode-state' import { useDarkModeState } from '../../../../hooks/common/use-dark-mode-state'
import { FrontmatterLinter } from './frontmatter-linter' import { FrontmatterLinter } from './frontmatter-linter'
import type { Diagnostic } from '@codemirror/lint' import type { Diagnostic } from '@codemirror/lint'
@ -23,7 +23,7 @@ export interface Linter {
const createLinterExtension = () => const createLinterExtension = () =>
linter((view) => linter((view) =>
optionalAppExtensions allAppExtensions
.flatMap((extension) => extension.buildCodeMirrorLinter()) .flatMap((extension) => extension.buildCodeMirrorLinter())
.concat(new FrontmatterLinter()) .concat(new FrontmatterLinter())
.flatMap((aLinter) => aLinter.lint(view)) .flatMap((aLinter) => aLinter.lint(view))

View file

@ -3,7 +3,7 @@
* *
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { optionalAppExtensions } from '../../../extensions/extra-integrations/optional-app-extensions' import { allAppExtensions } from '../../../extensions/extra-integrations/all-app-extensions'
import { useFrontendConfig } from '../../common/frontend-config-context/use-frontend-config' import { useFrontendConfig } from '../../common/frontend-config-context/use-frontend-config'
import type { MarkdownRendererExtension } from '../extensions/base/markdown-renderer-extension' import type { MarkdownRendererExtension } from '../extensions/base/markdown-renderer-extension'
import { DebuggerMarkdownExtension } from '../extensions/debugger-markdown-extension' import { DebuggerMarkdownExtension } from '../extensions/debugger-markdown-extension'
@ -32,7 +32,7 @@ export const useMarkdownExtensions = (
throw new Error("can't build markdown render extensions without event emitter.") throw new Error("can't build markdown render extensions without event emitter.")
} }
return [ return [
...optionalAppExtensions.flatMap((extension) => ...allAppExtensions.flatMap((extension) =>
extension.buildMarkdownRendererExtensions({ extension.buildMarkdownRendererExtensions({
frontendConfig: frontendConfig, frontendConfig: frontendConfig,
eventEmitter: extensionEventEmitter eventEmitter: extensionEventEmitter

View file

@ -49,7 +49,7 @@ const thirdPartyIntegrationAppExtensions: AppExtension[] = [
/** /**
* This array defines additional app extensions that are used in the editor, read only page and slideshow. * This array defines additional app extensions that are used in the editor, read only page and slideshow.
*/ */
export const optionalAppExtensions: AppExtension[] = [ export const allAppExtensions: AppExtension[] = [
...thirdPartyIntegrationAppExtensions, ...thirdPartyIntegrationAppExtensions,
new AlertAppExtension(), new AlertAppExtension(),
new BlockquoteAppExtension(), new BlockquoteAppExtension(),