Add key to image replacer (#379)

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
mrdrogdrog 2020-08-03 20:06:57 +02:00 committed by GitHub
parent 512bca02e7
commit 57baf2fab5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,9 +4,10 @@ import { ComponentReplacer } from '../ComponentReplacer'
import { ImageFrame } from './image-frame'
export class ImageReplacer implements ComponentReplacer {
getReplacement (node: DomElement): React.ReactElement | undefined {
getReplacement (node: DomElement, index: number): React.ReactElement | undefined {
if (node.name === 'img' && node.attribs) {
return <ImageFrame
key={index}
id={node.attribs.id}
className={node.attribs.class}
src={node.attribs.src}