aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/documents/Documents.ts19
-rw-r--r--src/client/util/DocumentManager.ts8
-rw-r--r--src/client/util/DragManager.ts2
-rw-r--r--src/client/views/nodes/LinkEditor.tsx11
4 files changed, 11 insertions, 29 deletions
diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts
index b11b5fdf2..ddbf8f753 100644
--- a/src/client/documents/Documents.ts
+++ b/src/client/documents/Documents.ts
@@ -68,25 +68,7 @@ export interface DocumentOptions {
}
const delegateKeys = ["x", "y", "width", "height", "panX", "panY"];
-// export interface LinkData {
-// anchor1: Doc;
-// anchor1Page: number;
-// anchor1Tags: Array<{ tag: string, name: string, description: string }>;
-// anchor2: Doc;
-// anchor2Page: number;
-// anchor2Tags: Array<{ tag: string, name: string, description: string }>;
-// }
-
-// export interface TagData {
-// tag: string;
-// name: string;
-// description: string;
-// }
-
export namespace DocUtils {
- // export function MakeLink(source: Doc, target: Doc, targetContext?: Doc, title: string = "", description: string = "", tags: string = "Default") {
- // let protoSrc = source.proto ? source.proto : source;
- // let protoTarg = target.proto ? target.proto : target;
export function MakeLink(source: Doc, target: Doc, targetContext?: Doc, title: string = "", description: string = "", tags: string = "Default") {
if (LinkManager.Instance.doesLinkExist(source, target)) return;
let sv = DocumentManager.Instance.getDocumentView(source);
@@ -154,7 +136,6 @@ export namespace Docs {
audioProto = fields[audioProtoId] as Doc || CreateAudioPrototype();
pdfProto = fields[pdfProtoId] as Doc || CreatePdfPrototype();
iconProto = fields[iconProtoId] as Doc || CreateIconPrototype();
- // linkProto = fields[linkProtoId] as Doc || CreateLinkPrototype();
});
}
diff --git a/src/client/util/DocumentManager.ts b/src/client/util/DocumentManager.ts
index 767abe63f..d7798ebfd 100644
--- a/src/client/util/DocumentManager.ts
+++ b/src/client/util/DocumentManager.ts
@@ -73,6 +73,9 @@ export class DocumentManager {
if (doc === toFind) {
toReturn.push(view);
} else {
+ // if (Doc.AreProtosEqual(doc, toFind)) {
+ // toReturn.push(view);
+
let docSrc = FieldValue(doc.proto);
if (docSrc && Object.is(docSrc, toFind)) {
toReturn.push(view);
@@ -100,11 +103,6 @@ export class DocumentManager {
return pairs;
}, [] as { a: DocumentView, b: DocumentView, l: Doc }[]);
- // console.log("LINKED DOCUMENT VIEWS");
- // pairs.forEach(p => {
- // console.log(StrCast(p.a.Document.title), p.a.props.Document[Id], StrCast(p.b.Document.title), p.b.props.Document[Id]);
- // });
-
return pairs;
}
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts
index 55d8c570f..27063d1c2 100644
--- a/src/client/util/DragManager.ts
+++ b/src/client/util/DragManager.ts
@@ -230,7 +230,7 @@ export namespace DragManager {
(dropData: { [id: string]: any }) => {
dropData.droppedDocuments = dragData.draggedDocuments.map(d => {
let dv = DocumentManager.Instance.getDocumentView(d);
-
+ // return d;
if (dv) {
if (dv.props.ContainingCollectionView === SelectionManager.SelectedDocuments()[0].props.ContainingCollectionView) {
return d;
diff --git a/src/client/views/nodes/LinkEditor.tsx b/src/client/views/nodes/LinkEditor.tsx
index 232331204..80eadf668 100644
--- a/src/client/views/nodes/LinkEditor.tsx
+++ b/src/client/views/nodes/LinkEditor.tsx
@@ -1,8 +1,8 @@
-import { observable, computed, action } from "mobx";
+import { observable, computed, action, trace } from "mobx";
import React = require("react");
import { observer } from "mobx-react";
import './LinkEditor.scss';
-import { StrCast, Cast } from "../../../new_fields/Types";
+import { StrCast, Cast, FieldValue } from "../../../new_fields/Types";
import { Doc } from "../../../new_fields/Doc";
import { LinkManager } from "../../util/LinkManager";
import { Docs } from "../../documents/Documents";
@@ -215,7 +215,10 @@ export class LinkGroupEditor extends React.Component<LinkGroupEditorProps> {
renderMetadata = (): JSX.Element[] => {
let metadata: Array<JSX.Element> = [];
let groupDoc = this.props.groupDoc;
- let mdDoc = Cast(groupDoc.metadata, Doc, new Doc);
+ const mdDoc = FieldValue(Cast(groupDoc.metadata, Doc));
+ if (!mdDoc) {
+ return [];
+ }
let groupType = StrCast(groupDoc.type);
let groupMdKeys = LinkManager.Instance.getMetadataKeysInGroup(groupType);
@@ -265,7 +268,7 @@ export class LinkGroupEditor extends React.Component<LinkGroupEditorProps> {
</>
);
}
-
+ trace();
return (
<div className="linkEditor-group">
<div className="linkEditor-group-row">