mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2026-06-23 04:10:17 +00:00
fix(frontend): buggy imports and type definitions due to TS-linting
These problems were detected by type-aware linting Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
committed by
Philip Molares
parent
faaea84a73
commit
50d0585ccb
@@ -8,7 +8,7 @@ import { PostApiRequestBuilder } from '../common/api-request-builder/post-api-re
|
||||
import { PutApiRequestBuilder } from '../common/api-request-builder/put-api-request-builder'
|
||||
import type { AliasCreateInterface, AliasUpdateInterface } from '@hedgedoc/commons'
|
||||
import { GetApiRequestBuilder } from '../common/api-request-builder/get-api-request-builder'
|
||||
import type { NoteAliasesInterface } from '@hedgedoc/commons/dist/esm'
|
||||
import type { NoteAliasesInterface } from '@hedgedoc/commons'
|
||||
|
||||
/**
|
||||
* Fetches the list of available aliases for a given note identified by one known alias.
|
||||
|
||||
@@ -6,13 +6,14 @@
|
||||
import { measurePerformance } from '../../../utils/measure-performance'
|
||||
import type { ParserOptions } from '@hedgedoc/html-to-react'
|
||||
import { convertHtmlToReact } from '@hedgedoc/html-to-react'
|
||||
import DOMPurify from 'dompurify'
|
||||
// see https://github.com/cure53/DOMPurify/issues/1034#issuecomment-2493211056
|
||||
import type { Config as DOMPurifyConfig } from 'dompurify'
|
||||
import DOMPurify from 'dompurify'
|
||||
import React, { Fragment, useMemo } from 'react'
|
||||
|
||||
export interface HtmlToReactProps {
|
||||
htmlCode: string
|
||||
domPurifyConfig?: DOMPurify.Config
|
||||
domPurifyConfig?: DOMPurifyConfig
|
||||
parserOptions?: ParserOptions
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useConfiguredMarkdownIt } from './hooks/use-configured-markdown-it'
|
||||
import { LineContentToLineIdMapper } from './utils/line-content-to-line-id-mapper'
|
||||
import { NodeToReactTransformer } from './utils/node-to-react-transformer'
|
||||
import type { ParserOptions } from '@hedgedoc/html-to-react'
|
||||
import type DOMPurify from 'dompurify'
|
||||
import type { Config as DOMPurifyConfig } from 'dompurify'
|
||||
import React, { useEffect, useMemo } from 'react'
|
||||
|
||||
export interface MarkdownToReactProps {
|
||||
@@ -70,7 +70,7 @@ export const MarkdownToReact: React.FC<MarkdownToReactProps> = ({
|
||||
markdownIt.render(markdownContentLines.join('\n'))
|
||||
)
|
||||
}, [markdownContentLines, markdownIt])
|
||||
const domPurifyConfig: DOMPurify.Config = useMemo(
|
||||
const domPurifyConfig: DOMPurifyConfig = useMemo(
|
||||
() => ({
|
||||
ADD_TAGS: markdownRenderExtensions.flatMap((extension) => extension.buildTagNameAllowList())
|
||||
}),
|
||||
|
||||
@@ -87,7 +87,7 @@ export const UiNotificationBoundary: React.FC<PropsWithChildren> = ({ children }
|
||||
(messageI18nKey: string, messageI18nOptions: Record<string, unknown> = {}, showErrorMessage = false) =>
|
||||
(error: Error): void => {
|
||||
log.error(t(messageI18nKey, messageI18nOptions), error)
|
||||
void dispatchUiNotification('common.errorOccurred', messageI18nKey, {
|
||||
dispatchUiNotification('common.errorOccurred', messageI18nKey, {
|
||||
contentI18nOptions: showErrorMessage
|
||||
? { ...messageI18nOptions, errorMessage: error.message }
|
||||
: messageI18nOptions,
|
||||
|
||||
+1
-3
@@ -10,9 +10,7 @@ import {
|
||||
} from '../../../components/markdown-renderer/replace-components/component-replacer'
|
||||
import { BlockquoteExtraTagMarkdownExtension } from './blockquote-extra-tag-markdown-extension'
|
||||
import { Optional } from '@mrdrogdrog/optional'
|
||||
import type { Element } from 'domhandler'
|
||||
import { isText } from 'domhandler'
|
||||
import type { Text } from 'domhandler/lib/node'
|
||||
import { isText, type Text, type Element } from 'domhandler'
|
||||
|
||||
/**
|
||||
* Replaces <blockquote-tag> elements with "color" as label and a valid color as content
|
||||
|
||||
@@ -14,7 +14,7 @@ import { buildStateFromMetadataUpdate } from './reducers/build-state-from-metada
|
||||
import type { CursorSelection } from '../../components/editor-page/editor-pane/tool-bar/formatters/types/cursor-selection'
|
||||
import { buildStateFromUpdateCursorPosition } from './reducers/build-state-from-update-cursor-position'
|
||||
import type { NoteInterface, NoteMetadataInterface, NotePermissionsInterface } from '@hedgedoc/commons'
|
||||
import type { NoteAliasesInterface } from '@hedgedoc/commons/dist/esm'
|
||||
import type { NoteAliasesInterface } from '@hedgedoc/commons'
|
||||
import { buildStateFromAliasesUpdate } from './reducers/build-state-from-aliases-update'
|
||||
|
||||
const noteDetailsSlice = createSlice({
|
||||
|
||||
Reference in New Issue
Block a user