From 58a892bfa8da0e4c181146528c764aa8664c216d Mon Sep 17 00:00:00 2001 From: ajmaley Date: Sat, 3 Nov 2018 14:28:36 -0400 Subject: [PATCH] Added ability to center images, resizing images (which I may need to revisit later), removed memory leak in FlamelinkImage.js --- src/components/FlameLinkImage.js | 14 ++++++-------- src/components/FlameLinkStructure.js | 5 ++++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/components/FlameLinkImage.js b/src/components/FlameLinkImage.js index 07521cc..aede55f 100644 --- a/src/components/FlameLinkImage.js +++ b/src/components/FlameLinkImage.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; +import Typography from '@material-ui/core/Typography'; import flamelinkApp from '../flamelink.js'; @@ -9,21 +10,18 @@ class FlameLinkImage extends Component { this.state = { mediaURL: '', } - } - getImage(imagePath){ - flamelinkApp.storage.getURL(imagePath) + flamelinkApp.storage.getURL(global.mediaID) .then(url => this.setState({ mediaURL: url })) - return - } + } render() { return( -
- {this.getImage(this.props.content)} -
+ + + ); } } diff --git a/src/components/FlameLinkStructure.js b/src/components/FlameLinkStructure.js index e1aeb7f..470a592 100644 --- a/src/components/FlameLinkStructure.js +++ b/src/components/FlameLinkStructure.js @@ -17,6 +17,8 @@ const styles = theme => ({ class FlameLinkStructure extends Component { constructor() { super(); + + global.mediaID = ''; this.state = { schemaContent: '', @@ -89,7 +91,8 @@ class FlameLinkStructure extends Component { } if (type === 'media'){ for (var val in this.state.schemaContent[key]){ - return + global.mediaID = this.state.schemaContent[key][val]; + return } } if (type === 'fieldset'){