Fix image preview not ignoring privacy setting (#536)
* Fix images not ignoring privacy setting during preview * Fix image detection not ignoring privacy setting during preview --------- Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
parent
2fbd4f8066
commit
1e23f787bd
|
@ -167,7 +167,7 @@ export function MarkdownInput ({ label, topLevel, groupClassName, onChange, setH
|
|||
: (
|
||||
<div className='form-group'>
|
||||
<div className={`${styles.text} form-control`}>
|
||||
<Text topLevel={topLevel} noFragments>{meta.value}</Text>
|
||||
<Text topLevel={topLevel} noFragments tab={tab}>{meta.value}</Text>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -63,13 +63,13 @@ function Heading ({ h, slugger, noFragments, topLevel, children, node, ...props
|
|||
}
|
||||
|
||||
// this is one of the slowest components to render
|
||||
export default memo(function Text ({ topLevel, noFragments, nofollow, imgproxyUrls, children }) {
|
||||
export default memo(function Text ({ topLevel, noFragments, nofollow, imgproxyUrls, children, tab }) {
|
||||
// all the reactStringReplace calls are to facilitate search highlighting
|
||||
const slugger = new GithubSlugger()
|
||||
|
||||
const HeadingWrapper = (props) => Heading({ topLevel, slugger, noFragments, ...props })
|
||||
|
||||
const imgUrlCache = useImgUrlCache(children, imgproxyUrls)
|
||||
const imgUrlCache = useImgUrlCache(children, { imgproxyUrls, tab })
|
||||
|
||||
return (
|
||||
<div className={styles.text}>
|
||||
|
@ -113,7 +113,7 @@ export default memo(function Text ({ topLevel, noFragments, nofollow, imgproxyUr
|
|||
// if `srcSet` is undefined, it means the image was not processed by worker yet
|
||||
// if `srcSet` is null, image was processed but this specific url was not detected as an image by the worker
|
||||
const srcSet = imgproxyUrls ? (imgproxyUrls[url] || null) : undefined
|
||||
return <ZoomableImage topLevel={topLevel} srcSet={srcSet} {...props} src={href} />
|
||||
return <ZoomableImage topLevel={topLevel} srcSet={srcSet} tab={tab} {...props} src={href} />
|
||||
}
|
||||
|
||||
// map: fix any highlighted links
|
||||
|
@ -141,7 +141,7 @@ export default memo(function Text ({ topLevel, noFragments, nofollow, imgproxyUr
|
|||
// if `srcSet` is undefined, it means the image was not processed by worker yet
|
||||
// if `srcSet` is null, image was processed but this specific url was not detected as an image by the worker
|
||||
const srcSet = imgproxyUrls ? (imgproxyUrls[url] || null) : undefined
|
||||
return <ZoomableImage topLevel={topLevel} srcSet={srcSet} src={src} {...props} />
|
||||
return <ZoomableImage topLevel={topLevel} srcSet={srcSet} tab={tab} src={src} {...props} />
|
||||
}
|
||||
}}
|
||||
remarkPlugins={[gfm, mention, sub, remarkDirective, searchHighlighter]}
|
||||
|
|
Loading…
Reference in New Issue