aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf
diff options
context:
space:
mode:
authoranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-16 17:52:05 -0500
committeranika-ahluwalia <anika.ahluwalia@gmail.com>2020-06-16 17:52:05 -0500
commit9018ac91f926df133738c86225838cfebdcf2270 (patch)
tree3d6cdb776b33a0b419861cf17fe6770841663289 /src/client/views/pdf
parent6345949e461dd0ef1a284527846462db7c7fb281 (diff)
parent4a0332994b38c8910077e6cc711e9e78c2964b67 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into anika_schema_view
Diffstat (limited to 'src/client/views/pdf')
-rw-r--r--src/client/views/pdf/PDFViewer.tsx26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index e39e96607..c02dd6786 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -126,16 +126,24 @@ export class PDFViewer extends ViewBoxAnnotatableComponent<IViewerProps, PdfDocu
// file address of the pdf
const { url: { href } } = Cast(this.dataDoc[this.props.fieldKey], PdfField)!;
const { url: relative } = this.props;
- const pathComponents = relative.split("/pdfs/")[1].split("/");
- const coreFilename = pathComponents.pop()!.split(".")[0];
- const params: any = {
- coreFilename,
- pageNum: this.Document.curPage || 1,
- };
- if (pathComponents.length) {
- params.subtree = `${pathComponents.join("/")}/`;
+ if (relative.includes("/pdfs/")) {
+ const pathComponents = relative.split("/pdfs/")[1].split("/");
+ const coreFilename = pathComponents.pop()!.split(".")[0];
+ const params: any = {
+ coreFilename,
+ pageNum: this.Document.curPage || 1,
+ };
+ if (pathComponents.length) {
+ params.subtree = `${pathComponents.join("/")}/`;
+ }
+ this._coverPath = href.startsWith(window.location.origin) ? await Networking.PostToServer("/thumbnail", params) : { width: 100, height: 100, path: "" };
+ } else {
+ const params: any = {
+ coreFilename: relative.split("/")[relative.split("/").length - 1],
+ pageNum: this.Document.curPage || 1,
+ };
+ this._coverPath = "http://cs.brown.edu/~bcz/face.gif";//href.startsWith(window.location.origin) ? await Networking.PostToServer("/thumbnail", params) : { width: 100, height: 100, path: "" };
}
- this._coverPath = href.startsWith(window.location.origin) ? await Networking.PostToServer("/thumbnail", params) : { width: 100, height: 100, path: "" };
runInAction(() => this._showWaiting = this._showCover = true);
this.props.startupLive && this.setupPdfJsViewer();
this._mainCont.current!.scrollTop = this.layoutDoc._scrollTop || 0;