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:
ekzyis 2023-10-02 14:28:39 +02:00 committed by GitHub
parent 2fbd4f8066
commit 1e23f787bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 9 deletions

View File

@ -167,7 +167,7 @@ export function MarkdownInput ({ label, topLevel, groupClassName, onChange, setH
: ( : (
<div className='form-group'> <div className='form-group'>
<div className={`${styles.text} form-control`}> <div className={`${styles.text} form-control`}>
<Text topLevel={topLevel} noFragments>{meta.value}</Text> <Text topLevel={topLevel} noFragments tab={tab}>{meta.value}</Text>
</div> </div>
</div> </div>
)} )}

File diff suppressed because one or more lines are too long

View File

@ -63,13 +63,13 @@ function Heading ({ h, slugger, noFragments, topLevel, children, node, ...props
} }
// this is one of the slowest components to render // 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 // all the reactStringReplace calls are to facilitate search highlighting
const slugger = new GithubSlugger() const slugger = new GithubSlugger()
const HeadingWrapper = (props) => Heading({ topLevel, slugger, noFragments, ...props }) const HeadingWrapper = (props) => Heading({ topLevel, slugger, noFragments, ...props })
const imgUrlCache = useImgUrlCache(children, imgproxyUrls) const imgUrlCache = useImgUrlCache(children, { imgproxyUrls, tab })
return ( return (
<div className={styles.text}> <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 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 // 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 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 // 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 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 // 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 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]} remarkPlugins={[gfm, mention, sub, remarkDirective, searchHighlighter]}