From 9c116867bb73b7d84654d9e56688ebd8a982462e Mon Sep 17 00:00:00 2001 From: monikahedman Date: Tue, 27 Aug 2019 17:45:20 -0400 Subject: about to make big changes --- src/client/views/linking/LinkFollowBox.tsx | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'src/client/views/linking/LinkFollowBox.tsx') diff --git a/src/client/views/linking/LinkFollowBox.tsx b/src/client/views/linking/LinkFollowBox.tsx index cf44ae649..588f48017 100644 --- a/src/client/views/linking/LinkFollowBox.tsx +++ b/src/client/views/linking/LinkFollowBox.tsx @@ -2,7 +2,7 @@ import { observable, computed, action, trace, ObservableMap, runInAction, reacti import React = require("react"); import { observer } from "mobx-react"; import { FieldViewProps, FieldView } from "../nodes/FieldView"; -import { Doc } from "../../../new_fields/Doc"; +import { Doc, DocListCastAsync } from "../../../new_fields/Doc"; import { undoBatch } from "../../util/UndoManager"; import { NumCast, FieldValue, Cast, StrCast } from "../../../new_fields/Types"; import { CollectionViewType } from "../collections/CollectionBaseView"; @@ -17,6 +17,9 @@ import { listSpec } from "../../../new_fields/Schema"; import { DocServer } from "../../DocServer"; import { RefField } from "../../../new_fields/RefField"; import { Docs } from "../../documents/Documents"; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { faTimes } from '@fortawesome/free-solid-svg-icons'; +import { CurrentUserUtils } from "../../../server/authentication/models/current_user_utils"; enum FollowModes { OPENTAB = "Open in Tab", @@ -48,7 +51,6 @@ export class LinkFollowBox extends React.Component { @observable canPan: boolean = false; @observable shouldUseOnlyParentContext = false; _contextDisposer?: IReactionDisposer; - collectionTypes: string[]; @observable private _docs: { col: Doc, target: Doc }[] = []; @observable private _otherDocs: { col: Doc, target: Doc }[] = []; @@ -56,8 +58,7 @@ export class LinkFollowBox extends React.Component { constructor(props: FieldViewProps) { super(props); LinkFollowBox.Instance = this; - - this.collectionTypes = ["Invalid", "Freeform", "Schema", "Docking", "Tree", "Stacking", "Masonry"]; + this.props.Document.isBackground = true; } @computed @@ -322,7 +323,7 @@ export class LinkFollowBox extends React.Component { } //set this to be the default link behavior, can be any of the above - private defaultLinkBehavior: (options?: any) => void = this.openLinkInPlace; + public defaultLinkBehavior: (options?: any) => void = this.openLinkRight; @action currentLinkBehavior = () => { @@ -556,12 +557,20 @@ export class LinkFollowBox extends React.Component { return null; } + async close() { + let res = await DocListCastAsync((CurrentUserUtils.UserDocument.overlays as Doc).data); + if (res) res.splice(res.indexOf(LinkFollowBox.Instance.props.Document), 1); + } + render() { return (
- {LinkFollowBox.linkDoc ? "Link Title: " + StrCast(LinkFollowBox.linkDoc.title) : "No Link Selected"} -
{LinkFollowBox.linkDoc ? +
+ {LinkFollowBox.linkDoc ? "Link Title: " + StrCast(LinkFollowBox.linkDoc.title) : "No Link Selected"} +
+
+
{LinkFollowBox.linkDoc ? LinkFollowBox.sourceDoc && LinkFollowBox.destinationDoc ? "Source: " + StrCast(LinkFollowBox.sourceDoc.title) + ", Destination: " + StrCast(LinkFollowBox.destinationDoc.title) : "" : ""}
@@ -586,6 +595,11 @@ export class LinkFollowBox extends React.Component {
+ +