aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-06-10 00:24:07 -0700
committerLionel Han <47760119+IGoByJoe@users.noreply.github.com>2020-06-10 00:24:07 -0700
commit69fc5cff21c212a6eca9d125836844eea018fad0 (patch)
treece72208a7c1d2aefb5fed4dbe32e36f9876eb2b4
parenta37ca793caefc203071f082490097b6231b0daf8 (diff)
functioning image upload
-rw-r--r--src/mobile/ImageUpload.tsx35
-rw-r--r--src/mobile/MobileInterface.tsx2
2 files changed, 13 insertions, 24 deletions
diff --git a/src/mobile/ImageUpload.tsx b/src/mobile/ImageUpload.tsx
index d5e7cec1b..504e4ceae 100644
--- a/src/mobile/ImageUpload.tsx
+++ b/src/mobile/ImageUpload.tsx
@@ -43,7 +43,9 @@ export class Uploader extends React.Component {
}
await Docs.Prototypes.initialize();
const imgPrev = document.getElementById("img_preview");
+ console.log("buddy");
if (imgPrev) {
+ console.log("hi");
const files: FileList | null = inputRef.current!.files;
if (files && files.length !== 0) {
console.log(files[0]);
@@ -103,12 +105,12 @@ export class Uploader extends React.Component {
if (slab7) {
slab7.style.opacity = "1";
}
- setTimeout(this.clearUpload, 3000);
+
}
});
}
-
+ setTimeout(this.clearUpload, 3000);
}
} catch (error) {
this.error = JSON.stringify(error);
@@ -120,22 +122,10 @@ export class Uploader extends React.Component {
inputLabel = async () => {
const files: FileList | null = inputRef.current!.files;
await files;
- var inputs = document.querySelectorAll('.inputFile');
- const label = document.getElementById("label");
- if (files && label && files.length !== 0) {
- label.innerText = await files[0].name;
- setTimeout(this.updateName, 1000);
- }
- }
-
- @action
- updateName = () => {
- const label = document.getElementById("label");
- if (label) {
- this.nm = label.innerText;
-
+ if (files && files.length !== 0) {
+ console.log(files);
+ this.nm = files[0].name;
}
- console.log("lol");
}
@action
@@ -168,19 +158,20 @@ export class Uploader extends React.Component {
if (slab7) {
slab7.style.opacity = "0.4";
}
+ this.nm = "Choose an image";
- const label = document.getElementById("label");
- if (label) {
- label.innerText = "Choose an image"
- this.nm = "Choose an image";
+ if (inputRef.current) {
+ inputRef.current.value = "";
}
+ console.log(inputRef.current!.files);
}
+
private get uploadInterface() {
return (
<div className="imgupload_cont">
- <input type="file" accept="image/*" className="inputFile" id="input_image_file" onClick={this.inputLabel} ref={inputRef}></input>
+ <input type="file" accept="image/*" className="inputFile" id="input_image_file" ref={inputRef} onChange={this.inputLabel}></input>
<label id="label" htmlFor="input_image_file">{this.nm}</label>
<div className="upload_label" onClick={this.onClick}>Upload Image</div>
{/* <div onClick={this.onClick} className="upload_button">Upload</div> */}
diff --git a/src/mobile/MobileInterface.tsx b/src/mobile/MobileInterface.tsx
index 73dcabac8..820a6885d 100644
--- a/src/mobile/MobileInterface.tsx
+++ b/src/mobile/MobileInterface.tsx
@@ -1731,7 +1731,6 @@ export class MobileInterface extends React.Component {
@action
closeUpload = () => {
this.imageUploadActive = false;
- console.log("1dude");
}
// toggleUpload = () => {
@@ -1749,7 +1748,6 @@ export class MobileInterface extends React.Component {
}
console.log("upload");
- const workspaces = Cast(this.userDoc.myWorkspaces, Doc) as Doc;
return (
<div>
<div className="closeUpload" onClick={this.toggleUpload}>