mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-03 08:28:54 -04:00
fix(frontend): migrate type changes
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
2f5dadb981
commit
61362f9175
37 changed files with 80 additions and 79 deletions
|
@ -26,10 +26,10 @@ export const useDocumentSyncScrolling = (
|
|||
outerContainerRef: React.RefObject<HTMLElement>,
|
||||
rendererRef: React.RefObject<HTMLElement>,
|
||||
numberOfLines: number,
|
||||
scrollState?: ScrollState,
|
||||
onScroll?: (scrollState: ScrollState) => void
|
||||
scrollState: ScrollState | null,
|
||||
onScroll: null | ((scrollState: ScrollState) => void)
|
||||
): [(lineMarkers: LineMarkerPosition[]) => void, React.UIEventHandler<HTMLElement>] => {
|
||||
const [lineMarks, setLineMarks] = useState<LineMarkerPosition[]>()
|
||||
const [lineMarks, setLineMarks] = useState<LineMarkerPosition[]>([])
|
||||
|
||||
const recalculateLineMarkerPositions = useCallback(
|
||||
(linkMarkerPositions: LineMarkerPosition[]) => {
|
||||
|
|
|
@ -19,7 +19,7 @@ import { useCallback } from 'react'
|
|||
export const useOnUserScroll = (
|
||||
lineMarks: LineMarkerPosition[] | undefined,
|
||||
scrollContainer: React.RefObject<HTMLElement>,
|
||||
onScroll: ((newScrollState: ScrollState) => void) | undefined
|
||||
onScroll: ((newScrollState: ScrollState) => void) | null
|
||||
): React.UIEventHandler<HTMLElement> => {
|
||||
return useCallback(() => {
|
||||
if (!scrollContainer.current || !lineMarks || lineMarks.length === 0 || !onScroll) {
|
||||
|
|
|
@ -18,8 +18,8 @@ import { useCallback, useEffect, useRef } from 'react'
|
|||
* @param scrollContainer The container to scroll in
|
||||
*/
|
||||
export const useScrollToLineMark = (
|
||||
scrollState: ScrollState | undefined,
|
||||
lineMarks: LineMarkerPosition[] | undefined,
|
||||
scrollState: ScrollState | null,
|
||||
lineMarks: LineMarkerPosition[],
|
||||
contentLineCount: number,
|
||||
scrollContainer: RefObject<HTMLElement>
|
||||
): void => {
|
||||
|
|
|
@ -57,8 +57,8 @@ export const DocumentMarkdownRenderer: React.FC<DocumentMarkdownRendererProps> =
|
|||
internalDocumentRenderPaneRef,
|
||||
rendererRef,
|
||||
contentLineCount,
|
||||
scrollState,
|
||||
onScroll
|
||||
scrollState ?? null,
|
||||
onScroll ?? null
|
||||
)
|
||||
|
||||
const markdownBodyRef = useRef<HTMLDivElement>(null)
|
||||
|
|
|
@ -16,7 +16,7 @@ import { useEffect } from 'react'
|
|||
*/
|
||||
export const useEditorReceiveHandler = <R extends RendererToEditorMessageType>(
|
||||
messageType: R,
|
||||
handler?: Handler<CommunicationMessages, R>
|
||||
handler: Handler<CommunicationMessages, R> | null
|
||||
): void => {
|
||||
const editorToRendererCommunicator = useEditorToRendererCommunicator()
|
||||
useEffect(() => {
|
||||
|
|
|
@ -15,7 +15,7 @@ import { useEffect } from 'react'
|
|||
* @param rendererReady Defines if the target renderer is ready
|
||||
*/
|
||||
export const useSendToRenderer = (
|
||||
message: undefined | Extract<CommunicationMessages, MessagePayload<EditorToRendererMessageType>>,
|
||||
message: null | Extract<CommunicationMessages, MessagePayload<EditorToRendererMessageType>>,
|
||||
rendererReady: boolean
|
||||
): void => {
|
||||
const iframeCommunicator = useEditorToRendererCommunicator()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue