diff options
author | Tyler Schicke <tyler_schicke@brown.edu> | 2019-01-18 19:57:18 -0500 |
---|---|---|
committer | Tyler Schicke <tyler_schicke@brown.edu> | 2019-01-18 19:57:18 -0500 |
commit | 657b07e5a0a4d73a0b9cd9b82b69178b1658ce8b (patch) | |
tree | 95917c195db75063cd8c244b6afe013830a27059 /src | |
parent | 1eb79ea2e6f2ddeea19b8cc399b373809279b862 (diff) |
Fixed issue in SetFieldValue
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.tsx | 4 | ||||
-rw-r--r-- | src/fields/Document.ts | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/Main.tsx b/src/Main.tsx index 604e443cf..09c2b111f 100644 --- a/src/Main.tsx +++ b/src/Main.tsx @@ -51,8 +51,12 @@ runInAction(() => { let doc4 = Documents.CollectionDocument(docset, { x: 100, y: 400 }); + let doc5 = Documents.ImageDocument("https://static.boredpanda.com/blog/wp-content/uploads/2018/04/5acb63d83493f__700-png.jpg", { + x: 650, y: 500 + }); mainNodeCollection.Docs.push(doc1); mainNodeCollection.Docs.push(doc2); mainNodeCollection.Docs.push(doc4); mainNodeCollection.Docs.push(doc3); + mainNodeCollection.Docs.push(doc5); });
\ No newline at end of file diff --git a/src/fields/Document.ts b/src/fields/Document.ts index c315beaef..0bba9c21e 100644 --- a/src/fields/Document.ts +++ b/src/fields/Document.ts @@ -5,7 +5,7 @@ import { ObservableMap } from "mobx"; export class Document extends Field { private fields: ObservableMap<Key, Field> = new ObservableMap(); - GetField(key: Key, ignoreProto?: boolean): Opt<Field> { + GetField(key: Key, ignoreProto: boolean = false): Opt<Field> { let field: Opt<Field>; if (ignoreProto) { if (this.fields.has(key)) { @@ -43,7 +43,7 @@ export class Document extends Field { } SetFieldValue<T extends Field>(key: Key, value: any, ctor: { new(): T }): boolean { - let field = this.GetField(key); + let field = this.GetField(key, true); if (field != null) { return field.TrySetValue(value); } else { |