added title attribute to images

fixes #518
This commit is contained in:
Philip Molares 2020-08-31 13:42:36 +02:00 committed by Philip Molares
parent 84df2ea1cf
commit 2decfc1fa2
2 changed files with 4 additions and 3 deletions

View file

@ -3,7 +3,7 @@ import { useSelector } from 'react-redux'
import { getProxiedUrl } from '../../../../api/media' import { getProxiedUrl } from '../../../../api/media'
import { ApplicationState } from '../../../../redux' import { ApplicationState } from '../../../../redux'
export const ImageFrame: React.FC<React.ImgHTMLAttributes<HTMLImageElement>> = ({ alt, src, ...props }) => { export const ImageFrame: React.FC<React.ImgHTMLAttributes<HTMLImageElement>> = ({ alt, src, title, ...props }) => {
const [imageUrl, setImageUrl] = useState('') const [imageUrl, setImageUrl] = useState('')
const imageProxyEnabled = useSelector((state: ApplicationState) => state.config.useImageProxy) const imageProxyEnabled = useSelector((state: ApplicationState) => state.config.useImageProxy)
@ -18,11 +18,11 @@ export const ImageFrame: React.FC<React.ImgHTMLAttributes<HTMLImageElement>> = (
if (imageProxyEnabled) { if (imageProxyEnabled) {
return ( return (
<img alt={alt} src={imageUrl} {...props}/> <img alt={alt} src={imageUrl} title={title ?? ''} {...props}/>
) )
} }
return ( return (
<img alt={alt} src={src ?? ''} {...props}/> <img alt={alt} src={src ?? ''} title={title ?? ''} {...props}/>
) )
} }

View file

@ -12,6 +12,7 @@ export class ImageReplacer implements ComponentReplacer {
className={node.attribs.class} className={node.attribs.class}
src={node.attribs.src} src={node.attribs.src}
alt={node.attribs.alt} alt={node.attribs.alt}
title={node.attribs.title}
width={node.attribs.width} width={node.attribs.width}
height={node.attribs.height} height={node.attribs.height}
/> />