aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/ImageBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-03-09 17:40:08 -0400
committerbobzel <zzzman@gmail.com>2025-03-09 17:40:08 -0400
commitdf173b02ffb7e2937d20a02beec1815b3af7c34e (patch)
treed5f9f383581818d302e9d42fe6f12eb2632763e9 /src/client/views/nodes/ImageBox.tsx
parent1a48ccf57ae43bc582dcd7be453e0ad217d38828 (diff)
removed simulation doc. fixed empty imageBox uploading. fixed script typechecking. fixed metadata doc. fixed setting background colors of docs that have a template.
Diffstat (limited to 'src/client/views/nodes/ImageBox.tsx')
-rw-r--r--src/client/views/nodes/ImageBox.tsx18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/client/views/nodes/ImageBox.tsx b/src/client/views/nodes/ImageBox.tsx
index 017ef7191..5b06e9fc5 100644
--- a/src/client/views/nodes/ImageBox.tsx
+++ b/src/client/views/nodes/ImageBox.tsx
@@ -148,9 +148,9 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
);
const { layoutDoc } = this;
this._disposers.path = reaction(
- () => ({ nativeSize: this.nativeSize, width: NumCast(this.layoutDoc._width) }),
- ({ nativeSize, width }) => {
- if ((layoutDoc === this.layoutDoc && !this.layoutDoc._layout_nativeDimEditable) || !this.layoutDoc._height) {
+ () => ({ nativeSize: this.nativeSize, width: NumCast(this.layoutDoc._width), height: this.layoutDoc._height }),
+ ({ nativeSize, width, height }) => {
+ if ((layoutDoc === this.layoutDoc && !this.layoutDoc._layout_nativeDimEditable) || !height) {
this.layoutDoc._height = (width * nativeSize.nativeHeight) / nativeSize.nativeWidth;
}
},
@@ -834,14 +834,10 @@ export class ImageBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
const file = input.files?.[0];
if (file) {
const disposer = OverlayView.ShowSpinner();
- const [{ result }] = await Networking.UploadFilesToServer({ file });
- if (result instanceof Error) {
- alert('Error uploading files - possibly due to unsupported file types');
- } else {
- this.dataDoc[this.fieldKey] = new ImageField(result.accessPaths.agnostic.client);
- !(result instanceof Error) && DocUtils.assignImageInfo(result, this.dataDoc);
- }
- disposer();
+ DocUtils.uploadFileToDoc(file, {}, this.Document).then(doc => {
+ disposer();
+ doc && (doc.height = undefined);
+ });
} else {
console.log('No file selected');
}