aboutsummaryrefslogtreecommitdiff
path: root/src/client/documents/Documents.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/documents/Documents.ts')
-rw-r--r--src/client/documents/Documents.ts22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index 029c3033d..f046af684 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -908,7 +908,7 @@ export namespace Docs {
export function ColorDocument(options: DocumentOptions = {}) {
return InstanceFromProto(Prototypes.get(DocumentType.COLOR), '', options);
}
- export function LoadingDocument(file: File | string, options: DocumentOptions, ytString?: string) {
+ export function LoadingDocument(file: File | string, options: DocumentOptions) {
return InstanceFromProto(Prototypes.get(DocumentType.LOADING), undefined, { _height: 150, _width: 200, title: typeof file == 'string' ? file : file.name, ...options }, undefined, '');
}
@@ -1758,7 +1758,6 @@ export namespace DocUtils {
const full = { ...options, _width: 400, title: name };
const pathname = Utils.prepend(result.accessPaths.agnostic.client);
const doc = await DocUtils.DocumentFromType(type, pathname, full, rootDoc);
- rootDoc && (rootDoc.isLoading = undefined) && Doc.removeCurrentlyLoading(rootDoc);
if (doc) {
const proto = Doc.GetProto(doc);
proto.text = result.rawText;
@@ -1790,6 +1789,9 @@ export namespace DocUtils {
if (Upload.isVideoInformation(result)) {
proto['data-duration'] = result.duration;
}
+ if (rootDoc) {
+ Doc.removeCurrentlyLoading(rootDoc);
+ }
generatedDocuments.push(doc);
}
}
@@ -1818,17 +1820,6 @@ export namespace DocUtils {
return tbox;
}
- export async function uploadYoutubeVideo(videoId: string, options: DocumentOptions) {
- const generatedDocuments: Doc[] = [];
- for (const {
- source: { name, type },
- result,
- } of await Networking.UploadYoutubeToServer(videoId)) {
- name && processFileupload(generatedDocuments, name, type, result, options);
- }
- return generatedDocuments;
- }
-
export function uploadYoutubeVideoLoading(videoId: string, options: DocumentOptions, overwriteDoc?: Doc) {
const generatedDocuments: Doc[] = [];
Networking.UploadYoutubeToServer(videoId).then(upfiles => {
@@ -1839,7 +1830,7 @@ export namespace DocUtils {
if ((result as any).message) {
if (overwriteDoc) {
overwriteDoc.isLoading = false;
- overwriteDoc.errorMessage = (result as any).message;
+ overwriteDoc.loadingError = (result as any).message;
Doc.removeCurrentlyLoading(overwriteDoc);
}
} else name && processFileupload(generatedDocuments, name, type, result, options, overwriteDoc);
@@ -1867,8 +1858,7 @@ export namespace DocUtils {
} = upfiles.lastElement() ?? { source: { name: '', type: '' }, result: { message: 'upload failed' } };
if ((result as any).message) {
if (overwriteDoc) {
- overwriteDoc.isLoading = false;
- overwriteDoc.errorMessage = (result as any).message;
+ overwriteDoc.loadingError = (result as any).message;
Doc.removeCurrentlyLoading(overwriteDoc);
}
} else name && type && processFileupload(generatedDocuments, name, type, result, options, overwriteDoc);