aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/Page.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-06-14 17:27:49 -0400
committerbob <bcz@cs.brown.edu>2019-06-14 17:27:49 -0400
commitf6e8b7a0f8a13ddf059cf701e46b8cbb8d9228f7 (patch)
tree9c9e64aac9836a3e842ecfccc69488198aa50ea0 /src/client/views/pdf/Page.tsx
parente9d07e9d84ff5b0419b36f73768c8b8583fd0607 (diff)
added page fwd/back/goto
Diffstat (limited to 'src/client/views/pdf/Page.tsx')
-rw-r--r--src/client/views/pdf/Page.tsx12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/client/views/pdf/Page.tsx b/src/client/views/pdf/Page.tsx
index 44c502a04..e3dbeaebe 100644
--- a/src/client/views/pdf/Page.tsx
+++ b/src/client/views/pdf/Page.tsx
@@ -132,16 +132,14 @@ export default class Page extends React.Component<IPageProps> {
}
}
- highlight = (targetDoc: Doc | undefined) => {
+ highlight = (targetDoc?: Doc) => {
// creates annotation documents for current highlights
let annotationDoc = this.props.makeAnnotationDocuments(targetDoc);
- let targetAnnotations = DocListCast(this.props.parent.Document.annotations);
- if (targetAnnotations) {
+ let targetAnnotations = Cast(this.props.parent.Document.annotations, listSpec(Doc));
+ if (targetAnnotations === undefined) {
+ Doc.GetProto(this.props.parent.Document).annotations = new List([annotationDoc]);
+ } else {
targetAnnotations.push(annotationDoc);
- this.props.parent.Document.annotations = new List<Doc>(targetAnnotations);
- }
- else {
- this.props.parent.Document.annotations = new List<Doc>([annotationDoc]);
}
return annotationDoc;
}