fix: image issues
This commit is contained in:
parent
261fa687ea
commit
8dbcb6494b
|
@ -87,17 +87,20 @@ export default function BlogPostModal({
|
|||
{
|
||||
code: CodeBlock,
|
||||
img: ({ ...props }) => {
|
||||
const { width, height } = props.src.match(
|
||||
/(?<width>\d+)x(?<height>\d+)/
|
||||
).groups;
|
||||
return (
|
||||
<Image
|
||||
src={props.src}
|
||||
alt={props.alt}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
);
|
||||
const r = props.src.match(/(?<width>\d+)x(?<height>\d+)/);
|
||||
if (r && r.groups) {
|
||||
return (
|
||||
<Image
|
||||
src={props.src}
|
||||
alt={props.alt}
|
||||
width={r?.groups.width}
|
||||
height={r?.groups.height}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
// fallback to normal img
|
||||
return <img {...props} />;
|
||||
}
|
||||
},
|
||||
} as any
|
||||
}
|
||||
|
|
|
@ -87,17 +87,20 @@ export default function ProjectModal({
|
|||
{
|
||||
code: CodeBlock,
|
||||
img: ({ ...props }) => {
|
||||
const { width, height } = props.src.match(
|
||||
/(?<width>\d+)x(?<height>\d+)/
|
||||
).groups;
|
||||
return (
|
||||
<Image
|
||||
src={props.src}
|
||||
alt={props.alt}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
);
|
||||
const r = props.src.match(/(?<width>\d+)x(?<height>\d+)/);
|
||||
if (r && r.groups) {
|
||||
return (
|
||||
<Image
|
||||
src={props.src}
|
||||
alt={props.alt}
|
||||
width={r?.groups.width}
|
||||
height={r?.groups.height}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
// fallback to normal img
|
||||
return <img {...props} />;
|
||||
}
|
||||
},
|
||||
} as any
|
||||
}
|
||||
|
|
|
@ -65,17 +65,20 @@ export default async function Page({
|
|||
{
|
||||
code: CodeBlock,
|
||||
img: ({ ...props }) => {
|
||||
const { width, height } = props.src.match(
|
||||
/(?<width>\d+)x(?<height>\d+)/
|
||||
).groups;
|
||||
return (
|
||||
<Image
|
||||
src={props.src}
|
||||
alt={props.alt}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
);
|
||||
const r = props.src.match(/(?<width>\d+)x(?<height>\d+)/);
|
||||
if (r && r.groups) {
|
||||
return (
|
||||
<Image
|
||||
src={props.src}
|
||||
alt={props.alt}
|
||||
width={r?.groups.width}
|
||||
height={r?.groups.height}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
// fallback to normal img
|
||||
return <img {...props} />;
|
||||
}
|
||||
},
|
||||
} as any
|
||||
}
|
||||
|
|
|
@ -64,17 +64,20 @@ export default async function Page({
|
|||
{
|
||||
code: CodeBlock,
|
||||
img: ({ ...props }) => {
|
||||
const { width, height } = props.src.match(
|
||||
/(?<width>\d+)x(?<height>\d+)/
|
||||
).groups;
|
||||
return (
|
||||
<Image
|
||||
src={props.src}
|
||||
alt={props.alt}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
);
|
||||
const r = props.src.match(/(?<width>\d+)x(?<height>\d+)/);
|
||||
if (r && r.groups) {
|
||||
return (
|
||||
<Image
|
||||
src={props.src}
|
||||
alt={props.alt}
|
||||
width={r?.groups.width}
|
||||
height={r?.groups.height}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
// fallback to normal img
|
||||
return <img {...props} />;
|
||||
}
|
||||
},
|
||||
} as any
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user