summaryrefslogtreecommitdiff
path: root/util/processOrg.tsx
diff options
context:
space:
mode:
authorThomas F. K. Jorna <[email protected]>2021-10-09 18:35:39 +0200
committerThomas F. K. Jorna <[email protected]>2021-10-09 18:35:39 +0200
commit6deb6247f63f5aaa25550dc0398d50221c5383c1 (patch)
treea04c90d9c26084a6a512308846b63903d4b60d57 /util/processOrg.tsx
parent03641ca2868d5ef21ffe426fa547dd859ce1c474 (diff)
fix: images in preview
Diffstat (limited to 'util/processOrg.tsx')
-rw-r--r--util/processOrg.tsx15
1 files changed, 13 insertions, 2 deletions
diff --git a/util/processOrg.tsx b/util/processOrg.tsx
index a025645..3f32d30 100644
--- a/util/processOrg.tsx
+++ b/util/processOrg.tsx
@@ -15,6 +15,7 @@ import rehype2react from 'rehype-react'
import { PreviewLink } from '../components/Sidebar/Link'
import { NodeByCite, NodeById } from '../pages'
import React, { useMemo } from 'react'
+import { OrgImage } from '../components/Sidebar/OrgImage'
export interface ProcessedOrgProps {
nodeById: NodeById
@@ -26,7 +27,14 @@ export interface ProcessedOrgProps {
}
export const ProcessedOrg = (props: ProcessedOrgProps) => {
- const { nodeById, setSidebarHighlightedNode, setPreviewNode, previewText, nodeByCite } = props
+ const {
+ nodeById,
+ setSidebarHighlightedNode,
+ setPreviewNode,
+ previewText,
+ nodeByCite,
+ previewNode,
+ } = props
const processor = unified()
.use(uniorgParse)
@@ -48,10 +56,13 @@ export const ProcessedOrg = (props: ProcessedOrgProps) => {
nodeById={nodeById}
setPreviewNode={setPreviewNode}
>
- {typeof children === 'string' ? children : null}
+ {children}
</PreviewLink>
)
},
+ img: ({ src }) => {
+ return <OrgImage src={src as string} file={previewNode.file} />
+ },
},
})