mirror of
https://github.com/dergigi/boris.git
synced 2026-01-04 07:24:27 +01:00
fix(reader): wire preview ref to markdown conversion hook
- Update useMarkdownToHTML to return {renderedHtml, previewRef}
- Use returned previewRef in ContentPanel hidden markdown preview
- Resolves article markdown not rendering instantly
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import React, { useMemo, useRef } from 'react'
|
||||
import React, { useMemo } from 'react'
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
||||
@@ -52,9 +52,7 @@ const ContentPanel: React.FC<ContentPanelProps> = ({
|
||||
onTextSelection,
|
||||
onClearSelection
|
||||
}) => {
|
||||
const markdownPreviewRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
const renderedMarkdownHtml = useMarkdownToHTML(markdown)
|
||||
const { renderedHtml: renderedMarkdownHtml, previewRef: markdownPreviewRef } = useMarkdownToHTML(markdown)
|
||||
|
||||
const { finalHtml, relevantHighlights } = useHighlightedContent({
|
||||
html,
|
||||
|
||||
Reference in New Issue
Block a user