From 258be2c304d8135c00e6024c1d58b97b690c4ea3 Mon Sep 17 00:00:00 2001
From: Joseph Weston <joseph.weston08@gmail.com>
Date: Tue, 6 Feb 2018 18:57:12 +0100
Subject: [PATCH] disable preview on file upload dropzones

The docs for react-dropzone say that we have to explicitly
free the 'file preview' to avoid memory leaks in the browser (!).
Presumably disabling previews means we don't have to manage this
ourselves.
---
 client/views/Exams.js | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/client/views/Exams.js b/client/views/Exams.js
index 746d739d5..345a650d5 100644
--- a/client/views/Exams.js
+++ b/client/views/Exams.js
@@ -186,7 +186,11 @@ class Exams extends React.Component {
               <h5 className='subtitle'>then we know that to do with PDF's</h5>
 
               <Dropzone accept=".yml, text/yaml, text/x-yaml, application/yaml, application/x-yaml"
-                style={{}} activeStyle={{borderStyle: 'dashed', width: 'fit-content', margin: 'auto'}} onDrop={this.onDropYAML}>
+                style={{}} activeStyle={{borderStyle: 'dashed', width: 'fit-content', margin: 'auto'}}
+                onDrop={this.onDropYAML}
+                disablePreview="true"
+                multiple="false"
+                >
                 <div className="file has-name is-boxed is-centered">
                   <label className="file-label"> 
                     <span className="file-cta">
@@ -235,8 +239,11 @@ class Exams extends React.Component {
 
               <Dropzone accept={"application/pdf"} style={{}}
                 activeStyle={{borderStyle: 'dashed', width: 'fit-content', margin: 'auto'}}
-                onDrop={this.onDropPDF.bind(this)}
-                disabled={isDisabled}>
+                onDrop={this.onDropPDF}
+                disabled={isDisabled}
+                disablePreview="true"
+                multiple="true"
+                >
                 <div className="file has-name is-boxed is-centered">
                   <label className="file-label">
                     <span className="file-cta" disabled={isDisabled}>
-- 
GitLab