aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/DocUtils.ts
diff options
context:
space:
mode:
authorJoanne <zehan_ding@brown.edu>2025-05-12 21:00:38 -0400
committerJoanne <zehan_ding@brown.edu>2025-05-12 21:00:38 -0400
commit430db63077868fa54829721d6530a810aa4d4588 (patch)
tree4b1ac30d8f5d90ba4b9d5e45414e6222d3af0e09 /src/client/documents/DocUtils.ts
parentcd93c88b8fee83a99342eac4dc60f7b4373fa843 (diff)
parent0c3f86d57225a2991920adef3a337bc13e408ac0 (diff)
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/client/documents/DocUtils.ts')
-rw-r--r--src/client/documents/DocUtils.ts22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/client/documents/DocUtils.ts b/src/client/documents/DocUtils.ts
index df14dce5a..36e03daed 100644
--- a/src/client/documents/DocUtils.ts
+++ b/src/client/documents/DocUtils.ts
@@ -603,7 +603,7 @@ export namespace DocUtils {
layout_hideAllLinks: true,
_width: 15,
_height: 15,
- _xPadding: 0,
+ _xMargin: 0,
onClick: FollowLinkScript(),
_timecodeToShow: Cast(doc._timecodeToShow, 'number', null),
});
@@ -642,8 +642,15 @@ export namespace DocUtils {
return dd;
}
- export function assignImageInfo(result: Upload.FileInformation, protoIn: Doc) {
+ export function assignUploadInfo(result: Upload.FileInformation, protoIn: Doc) {
const proto = protoIn;
+
+ if (Upload.isTextInformation(result)) {
+ proto.text = result.rawText;
+ }
+ if (Upload.isVideoInformation(result)) {
+ proto.data_duration = result.duration;
+ }
if (Upload.isImageInformation(result)) {
const maxNativeDim = Math.max(result.nativeHeight, result.nativeWidth);
const exifRotation = StrCast(result.exifData?.data?.Orientation).toLowerCase();
@@ -677,15 +684,8 @@ export namespace DocUtils {
const pathname = result.accessPaths.agnostic.client;
const doc = await DocUtils.DocumentFromType(type, pathname, full, overwriteDoc);
if (doc) {
- const proto = Doc.GetProto(doc);
- proto.text = result.rawText;
- !(result instanceof Error) && DocUtils.assignImageInfo(result, proto);
- if (Upload.isVideoInformation(result)) {
- proto.data_duration = result.duration;
- }
- if (overwriteDoc) {
- Doc.removeCurrentlyLoading(overwriteDoc);
- }
+ DocUtils.assignUploadInfo(result, Doc.GetProto(doc));
+ overwriteDoc && Doc.removeCurrentlyLoading(overwriteDoc);
generatedDocuments.push(doc);
}
return doc;