mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
fix(markdown): address inline image review feedback
Keep the leading slash when resolving relative paths against an absolute markdown file, retry an inline image when its source changes after a load failure, and render linked markdown images without a nested expand button.
This commit is contained in:
1 parent
458f26134b
commit
f488b8762d
7 files changed
+118
-22
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import type { ComponentPropsWithoutRef } from 'react'
|
||||
import type { ExtraProps } from 'react-markdown'
|
||||
import { InlineImage } from '@/components/ui/inline-image'
|
||||
import { useIsInsideMarkdownLink } from '@/components/ui/markdown-link'
|
||||
import { getFileApiUrl } from '@/api/files'
|
||||
import { getLocalLinkPath } from '@/lib/markdownLinks'
|
||||
|
||||
@@ -14,6 +15,8 @@ type MarkdownImageProps = ComponentPropsWithoutRef<'img'> & ExtraProps & {
|
||||
* `data:image/*` URIs, is rendered unchanged.
|
||||
*/
|
||||
export function MarkdownImage({ src, alt, resolveLocalPath }: MarkdownImageProps) {
|
||||
const insideLink = useIsInsideMarkdownLink()
|
||||
|
||||
if (typeof src !== 'string' || src === '') {
|
||||
return null
|
||||
}
|
||||
@@ -30,5 +33,5 @@ export function MarkdownImage({ src, alt, resolveLocalPath }: MarkdownImageProps
|
||||
}
|
||||
}
|
||||
|
||||
return <InlineImage src={imageSrc} alt={alt} />
|
||||
return <InlineImage src={imageSrc} alt={alt} expandable={!insideLink} />
|
||||
}
|
||||
Reference in new issue
Block a user