aboutsummaryrefslogtreecommitdiff
path: root/src/mobile/ImageUpload.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-08-30 13:10:54 -0400
committerbobzel <zzzman@gmail.com>2020-08-30 13:10:54 -0400
commit561a8d0bd130ea5c1fd68a4dd2344f0333d388cc (patch)
treed9b932529c86c26661967f573b26cbf9c2177f60 /src/mobile/ImageUpload.tsx
parente8856332c19abe12fe43c940e35b49ab77aae612 (diff)
fixed importBox upload to give feedback, share code. fixed stacking autoHeight to happen immediately. fixed images to not need to request image information. changed doc decorations to change image native width. changed alert() when dropping on impermissibale doc. fixed allow dropping over images,etc. changed default image nativeSize to 900
Diffstat (limited to 'src/mobile/ImageUpload.tsx')
-rw-r--r--src/mobile/ImageUpload.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mobile/ImageUpload.tsx b/src/mobile/ImageUpload.tsx
index 0ae952304..1ee4c7815 100644
--- a/src/mobile/ImageUpload.tsx
+++ b/src/mobile/ImageUpload.tsx
@@ -5,6 +5,7 @@ import * as rp from 'request-promise';
import { DocServer } from '../client/DocServer';
import { Docs } from '../client/documents/Documents';
import { Networking } from '../client/Network';
+import { DFLT_IMAGE_NATIVE_DIM } from '../client/views/globalCssVariables.scss';
import { MainViewModal } from '../client/views/MainViewModal';
import { Doc, Opt } from '../fields/Doc';
import { List } from '../fields/List';
@@ -20,6 +21,7 @@ export interface ImageUploadProps {
}
const inputRef = React.createRef<HTMLInputElement>();
+const defaultNativeImageDim = Number(DFLT_IMAGE_NATIVE_DIM.replace("px", ""));
@observer
export class Uploader extends React.Component<ImageUploadProps> {
@@ -52,13 +54,13 @@ export class Uploader extends React.Component<ImageUploadProps> {
let doc = null;
// Case 1: File is a video
if (file.type === "video/mp4") {
- doc = Docs.Create.VideoDocument(path, { _nativeWidth: 400, _width: 400, title: name });
+ doc = Docs.Create.VideoDocument(path, { _nativeWidth: defaultNativeImageDim, _width: 400, title: name });
// Case 2: File is a PDF document
} else if (file.type === "application/pdf") {
- doc = Docs.Create.PdfDocument(path, { _nativeWidth: 400, _width: 400, _fitWidth: true, title: name });
+ doc = Docs.Create.PdfDocument(path, { _nativeWidth: defaultNativeImageDim, _width: 400, _fitWidth: true, title: name });
// Case 3: File is another document type (most likely Image)
} else {
- doc = Docs.Create.ImageDocument(path, { _nativeWidth: 400, _width: 400, title: name });
+ doc = Docs.Create.ImageDocument(path, { _nativeWidth: defaultNativeImageDim, _width: 400, title: name });
}
this.setOpacity(4, "1"); // Slab 4
const res = await rp.get(Utils.prepend("/getUserDocumentId"));