mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-25 12:34:45 -04:00
Move markdown split into redux (#1681)
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
71e668cd17
commit
6594e1bb86
30 changed files with 217 additions and 226 deletions
|
@ -24,7 +24,7 @@ export interface RendererProps extends ScrollProps {
|
|||
onFirstHeadingChange?: (firstHeading: string | undefined) => void
|
||||
onTaskCheckedChange?: (lineInMarkdown: number, checked: boolean) => void
|
||||
documentRenderPaneRef?: MutableRefObject<HTMLDivElement | null>
|
||||
markdownContent: string
|
||||
markdownContentLines: string[]
|
||||
onImageClick?: ImageClickHandler
|
||||
onHeightChange?: (height: number) => void
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ export const MarkdownDocument: React.FC<MarkdownDocumentProps> = ({
|
|||
onMakeScrollSource,
|
||||
onTaskCheckedChange,
|
||||
baseUrl,
|
||||
markdownContent,
|
||||
markdownContentLines,
|
||||
onImageClick,
|
||||
onScroll,
|
||||
scrollState,
|
||||
|
@ -70,7 +70,7 @@ export const MarkdownDocument: React.FC<MarkdownDocumentProps> = ({
|
|||
onHeightChange(rendererSize.height ? rendererSize.height + 1 : 0)
|
||||
}, [rendererSize.height, onHeightChange])
|
||||
|
||||
const contentLineCount = useMemo(() => markdownContent.split('\n').length, [markdownContent])
|
||||
const contentLineCount = useMemo(() => markdownContentLines.length, [markdownContentLines])
|
||||
const [onLineMarkerPositionChanged, onUserScroll] = useDocumentSyncScrolling(
|
||||
internalDocumentRenderPaneRef,
|
||||
rendererRef,
|
||||
|
@ -92,7 +92,7 @@ export const MarkdownDocument: React.FC<MarkdownDocumentProps> = ({
|
|||
<DocumentMarkdownRenderer
|
||||
outerContainerRef={rendererRef}
|
||||
className={`mb-3 ${additionalRendererClasses ?? ''}`}
|
||||
content={markdownContent}
|
||||
markdownContentLines={markdownContentLines}
|
||||
onFirstHeadingChange={onFirstHeadingChange}
|
||||
onLineMarkerPositionChanged={onLineMarkerPositionChanged}
|
||||
onTaskCheckedChange={onTaskCheckedChange}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue