aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/DocumentManager.ts
diff options
context:
space:
mode:
authorAndrew Kim <andrewdkim@users.noreply.github.com>2019-04-20 18:42:01 -0400
committerAndrew Kim <andrewdkim@users.noreply.github.com>2019-04-20 18:42:01 -0400
commit840de58f003d0962ef7d3a0ad6ea284d1f4870db (patch)
tree32377ecaedceb24e54b6645ae76f3a5e0171fd54 /src/client/util/DocumentManager.ts
parent604d20941837fa90c06a7da7e77a27c262cd4648 (diff)
parente47656cdc18aa1fd801a3853fa0f819140a68646 (diff)
update
Diffstat (limited to 'src/client/util/DocumentManager.ts')
-rw-r--r--src/client/util/DocumentManager.ts37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index f38b8ca75..56669fb79 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -1,11 +1,9 @@
-import React = require('react');
-import { observer } from 'mobx-react';
-import { observable, action, computed } from 'mobx';
+import { computed, observable } from 'mobx';
import { Document } from "../../fields/Document";
-import { DocumentView } from '../views/nodes/DocumentView';
-import { KeyStore } from '../../fields/KeyStore';
import { FieldWaiting } from '../../fields/Field';
+import { KeyStore } from '../../fields/KeyStore';
import { ListField } from '../../fields/ListField';
+import { DocumentView } from '../views/nodes/DocumentView';
export class DocumentManager {
@@ -27,11 +25,6 @@ export class DocumentManager {
// this.DocumentViews = new Array<DocumentView>();
}
- public getAllDocumentViews(collection: Document) {
- return this.DocumentViews.filter(dv =>
- dv.props.ContainingCollectionView && dv.props.ContainingCollectionView.props.Document === collection);
- }
-
public getDocumentView(toFind: Document): DocumentView | null {
let toReturn: DocumentView | null;
@@ -40,19 +33,24 @@ export class DocumentManager {
//gets document view that is in a freeform canvas collection
DocumentManager.Instance.DocumentViews.map(view => {
let doc = view.props.Document;
- // if (view.props.ContainingCollectionView instanceof CollectionFreeFormView) {
if (doc === toFind) {
toReturn = view;
return;
}
- let docSrc = doc.GetT(KeyStore.Prototype, Document);
- if (docSrc && docSrc !== FieldWaiting && Object.is(docSrc, toFind)) {
- toReturn = view;
- }
});
+ if (!toReturn) {
+ DocumentManager.Instance.DocumentViews.map(view => {
+ let doc = view.props.Document;
+
+ let docSrc = doc.GetT(KeyStore.Prototype, Document);
+ if (docSrc && docSrc !== FieldWaiting && Object.is(docSrc, toFind)) {
+ toReturn = view;
+ }
+ });
+ }
- return (toReturn);
+ return toReturn;
}
public getDocumentViews(toFind: Document): DocumentView[] {
@@ -73,7 +71,7 @@ export class DocumentManager {
}
});
- return (toReturn);
+ return toReturn;
}
@computed
@@ -85,9 +83,8 @@ export class DocumentManager {
if (link instanceof Document) {
let linkToDoc = link.GetT(KeyStore.LinkedToDocs, Document);
if (linkToDoc && linkToDoc !== FieldWaiting) {
- DocumentManager.Instance.getDocumentViews(linkToDoc).map(docView1 => {
- pairs.push({ a: dv, b: docView1, l: link });
- });
+ DocumentManager.Instance.getDocumentViews(linkToDoc).map(docView1 =>
+ pairs.push({ a: dv, b: docView1, l: link }));
}
}
return pairs;