diff options
author | yipstanley <stanley_yip@brown.edu> | 2019-06-20 19:43:25 -0400 |
---|---|---|
committer | yipstanley <stanley_yip@brown.edu> | 2019-06-20 19:43:25 -0400 |
commit | 25561f70206871432ebb24e787e7222e98584a49 (patch) | |
tree | c8abc490642166521b04534b4fde0fe9f15afc89 /src/client/views/nodes/PDFBox.tsx | |
parent | aea1f5d804efd5bd38d72caf17d275304c3f7962 (diff) |
artgh
Diffstat (limited to 'src/client/views/nodes/PDFBox.tsx')
-rw-r--r-- | src/client/views/nodes/PDFBox.tsx | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/client/views/nodes/PDFBox.tsx b/src/client/views/nodes/PDFBox.tsx index 8daea2541..10a346269 100644 --- a/src/client/views/nodes/PDFBox.tsx +++ b/src/client/views/nodes/PDFBox.tsx @@ -1,7 +1,7 @@ import { action, IReactionDisposer, observable, reaction, trace, untracked } from 'mobx'; import { observer } from "mobx-react"; import 'react-image-lightbox/style.css'; -import { WidthSym } from "../../../new_fields/Doc"; +import { WidthSym, Doc } from "../../../new_fields/Doc"; import { makeInterface } from "../../../new_fields/Schema"; import { Cast, NumCast } from "../../../new_fields/Types"; import { PdfField } from "../../../new_fields/URLField"; @@ -17,6 +17,8 @@ import { FieldView, FieldViewProps } from './FieldView'; import { pageSchema } from "./ImageBox"; import "./PDFBox.scss"; import React = require("react"); +import { CompileScript } from '../../util/Scripting'; +import { ScriptField } from '../../../fields/ScriptField'; type PdfDocument = makeInterface<[typeof positionSchema, typeof pageSchema]>; const PdfDocument = makeInterface(positionSchema, pageSchema); @@ -42,25 +44,15 @@ export class PDFBox extends DocComponent<FieldViewProps, PdfDocument>(PdfDocumen } } ); + + let script = CompileScript("return this.page === 2", { params: { this: Doc.name } }); + if (script.compiled) { + this.props.Document.filterScript = new ScriptField(script); + } } - @action componentDidMount() { if (this.props.setPdfBox) this.props.setPdfBox(this); - - this._scrollY = NumCast(this.Document.startY); - this.props.Document.scrollY = this.Document.startY; - // let ccv = this.props.ContainingCollectionView; - // if (ccv) { - // ccv.props.Document.scrollY = this.Document.startY; - // } - } - - componentWillUnmount() { - let ccv = this.props.ContainingCollectionView; - if (ccv) { - ccv.props.Document.scrollY = this.Document.startY; - } } public GetPage() { |