Skip to content

Commit

Permalink
MM-60425 Making clickable images work inside Markdown (#8215)
Browse files Browse the repository at this point in the history
* fix: disables the gallery click on images inside a markdown link

* feat: removing the logic for acknowledging children that is inside link

* chore: renaming for consistency
  • Loading branch information
panoramix360 authored Oct 7, 2024
1 parent 1c299c4 commit 603ea79
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/components/markdown/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,15 @@ const Markdown = ({
return null;
}

const isInsideLink = context.indexOf('link') !== -1;

const disableInteraction = (disableGallery ?? Boolean(!location)) || isInsideLink;

if (context.indexOf('table') !== -1) {
// We have enough problems rendering images as is, so just render a link inside of a table
return (
<MarkdownTableImage
disabled={disableGallery ?? Boolean(!location)}
disabled={disableInteraction}
imagesMetadata={imagesMetadata}
location={location}
postId={postId!}
Expand All @@ -372,7 +376,7 @@ const Markdown = ({

return (
<MarkdownImage
disabled={disableGallery ?? Boolean(!location)}
disabled={disableInteraction}
errorTextStyle={[computeTextStyle(textStyles, baseTextStyle, context), textStyles.error]}
layoutHeight={layoutHeight}
layoutWidth={layoutWidth}
Expand Down Expand Up @@ -407,6 +411,7 @@ const Markdown = ({
if (isUnsafeLinksPost) {
return renderText({context: [], literal: href});
}

return (
<MarkdownLink
href={href}
Expand Down

0 comments on commit 603ea79

Please sign in to comment.