-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: populated image src in markdown
Signed-off-by: Innei <[email protected]>
- Loading branch information
Showing
2 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
apps/renderer/src/components/ui/markdown/renderers/InlineImage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { cn } from "~/lib/utils" | ||
import { useEntryContentContext } from "~/modules/entry-content/hooks" | ||
|
||
import { Media } from "../../media" | ||
import { usePopulatedFullUrl } from "../utils" | ||
|
||
export const MarkdownInlineImage = ( | ||
props: React.ImgHTMLAttributes<HTMLImageElement> & { | ||
proxy?: { | ||
width: number | ||
height: number | ||
} | ||
}, | ||
) => { | ||
const { feedId } = useEntryContentContext() | ||
const populatedUrl = usePopulatedFullUrl(feedId, props.src) | ||
return ( | ||
<Media | ||
type="photo" | ||
{...props} | ||
src={populatedUrl} | ||
mediaContainerClassName={cn("inline max-w-full rounded-md")} | ||
popper | ||
className="inline" | ||
showFallback | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters