diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-02-08 00:23:27 -0500 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-02-08 00:23:27 -0500 |
commit | c1581aaf93467cce8fca8a3da71181d79b3bfef8 (patch) | |
tree | a53528ba81f9e791111f3040993a24efd7d1769d | |
parent | 35574735a60fbc7b1c7051c59db56a8485f50a21 (diff) |
a couple small changes
-rw-r--r-- | src/Main.tsx | 2 | ||||
-rw-r--r-- | src/fields/ImageField.ts | 4 | ||||
-rw-r--r-- | src/util/Scripting.ts | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/Main.tsx b/src/Main.tsx index a9ed1a365..fa6230393 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -13,6 +13,7 @@ import "./Main.scss"; import { ContextMenu } from './views/ContextMenu'; import { DocumentView } from './views/nodes/DocumentView'; import { CompileScript } from './util/Scripting'; +import { ImageField } from './fields/ImageField'; configure({ @@ -46,6 +47,7 @@ document.addEventListener("pointerdown", action(function (e: PointerEvent) { let doc3 = Documents.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { x: 450, y: 500, title: "cat 1" }); + doc3.Set(KeyStore.Data, new ImageField); const schemaDocs = Array.from(Array(5).keys()).map(v => Documents.ImageDocument("https://upload.wikimedia.org/wikipedia/commons/thumb/3/3a/Cat03.jpg/1200px-Cat03.jpg", { x: 50 + 100 * v, y: 50, width: 100, height: 100, title: "cat" + v })); diff --git a/src/fields/ImageField.ts b/src/fields/ImageField.ts index 63baf815b..d82260f54 100644 --- a/src/fields/ImageField.ts +++ b/src/fields/ImageField.ts @@ -3,7 +3,7 @@ import { Field } from "./Field"; export class ImageField extends BasicField<URL> { constructor(data: URL | undefined = undefined) { - super(data == undefined ? new URL("http://cs.brown.edu/~bcz/face.gif") : data); + super(data == undefined ? new URL("http://cs.brown.edu/~bcz/bob_fettucine.jpg") : data); } toString(): string { @@ -11,7 +11,7 @@ export class ImageField extends BasicField<URL> { } ToScriptString(): string { - return `new ImageField(${this.Data})`; + return `new ImageField("${this.Data}")`; } Copy(): Field { diff --git a/src/util/Scripting.ts b/src/util/Scripting.ts index e0d39bdfa..0e83ab4f0 100644 --- a/src/util/Scripting.ts +++ b/src/util/Scripting.ts @@ -3,6 +3,7 @@ let ts = (window as any).ts; import { Opt, Field } from "../fields/Field"; import { Document as DocumentImport } from "../fields/Document"; import { NumberField as NumberFieldImport, NumberField } from "../fields/NumberField"; +import { ImageField as ImageFieldImport } from "../fields/ImageField"; import { TextField as TextFieldImport, TextField } from "../fields/TextField"; import { RichTextField as RichTextFieldImport } from "../fields/RichTextField"; import { KeyStore as KeyStoreImport } from "../fields/Key"; @@ -23,6 +24,7 @@ function ExecScript(script: string, diagnostics: Opt<any[]>): ExecutableScript { let Document = DocumentImport; let NumberField = NumberFieldImport; let TextField = TextFieldImport; + let ImageField = ImageFieldImport; let RichTextField = RichTextFieldImport; let window = undefined; let document = undefined; |