aboutsummaryrefslogtreecommitdiff
path: root/src/fields/PDFField.ts
diff options
context:
space:
mode:
authorAndrew Kim <andrewdkim@users.noreply.github.com>2019-03-05 18:51:20 -0500
committerAndrew Kim <andrewdkim@users.noreply.github.com>2019-03-05 18:51:20 -0500
commit7f93e6639e8fee3e3760d13c69d65b343875091a (patch)
treed29b45310f92a53935177d969ce3c1bee9920c32 /src/fields/PDFField.ts
parent9b839a93b98b850aa77087218d4862b97fb24d15 (diff)
parent2cc5eb6ff512dc6128d25903bcb852f25bcadcca (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web into PDFNode
Diffstat (limited to 'src/fields/PDFField.ts')
-rw-r--r--src/fields/PDFField.ts25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/fields/PDFField.ts b/src/fields/PDFField.ts
index 2d8b0f635..0db47a884 100644
--- a/src/fields/PDFField.ts
+++ b/src/fields/PDFField.ts
@@ -1,10 +1,13 @@
import { BasicField } from "./BasicField";
import { Field } from "./Field";
-import {observable} from "mobx"
+import { observable } from "mobx"
+import { Types } from "../server/Message";
+
+
export class PDFField extends BasicField<URL> {
- constructor(data: URL | undefined = undefined) {
- super(data == undefined ? new URL("http://cs.brown.edu/~bcz/face.gif") : data);
+ constructor(data: URL | undefined = undefined, save: boolean = true) {
+ super(data || new URL("http://cs.brown.edu/~bcz/face.gif"), save);
}
toString(): string {
@@ -14,8 +17,20 @@ export class PDFField extends BasicField<URL> {
Copy(): Field {
return new PDFField(this.Data);
}
-
+
+ ToScriptString(): string {
+ return `new PDFField("${this.Data}")`;
+ }
+
+ ToJson(): { type: Types, data: URL, _id: string } {
+ return {
+ type: Types.PDF,
+ data: this.Data,
+ _id: this.Id
+ }
+ }
+
@observable
- Page:Number = 1;
+ Page: Number = 1;
} \ No newline at end of file