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.scss | 23 +++ src/client/views/linking/LinkFollowBox.tsx | 28 +++- src/client/views/linking/LinkMenuItem.tsx | 214 ++++------------------------ 3 files changed, 69 insertions(+), 196 deletions(-) (limited to 'src/client/views/linking') diff --git a/src/client/views/linking/LinkFollowBox.scss b/src/client/views/linking/LinkFollowBox.scss index a34285727..e425bde69 100644 --- a/src/client/views/linking/LinkFollowBox.scss +++ b/src/client/views/linking/LinkFollowBox.scss @@ -18,12 +18,35 @@ // line-height: 30px; letter-spacing: 2px; font-size: 16px; + width: 100%; } .direction-indicator { font-size: 12px; } + .closeDocument { + position: relative; + // z-index: inherit; + max-width: 30px; + top: -20px; + // left: 230px; + left: 460px; + color: $darker-alt-accent // right: 5px; + } + + .closeDocument:hover { + color: $main-accent; + } + + .topHeader { + // display: grid; + // grid-template-columns: 90% 10%; + width: 100%; + // flex-direction: row; + height: 25px; + } + .linkFollowBox-footer { height: 50px; text-align: center; 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 {
+ +
{this._showMore ? this.renderMetadata() : <>} @@ -254,44 +130,4 @@ export class LinkMenuItem extends React.Component { ); } -} - - // @undoBatch - // onFollowLink = async (e: React.PointerEvent): Promise => { - // e.stopPropagation(); - // e.persist(); - // let jumpToDoc = this.props.destinationDoc; - // let pdfDoc = FieldValue(Cast(this.props.destinationDoc, Doc)); - // if (pdfDoc) { - // jumpToDoc = pdfDoc; - // } - // let proto = Doc.GetProto(this.props.linkDoc); - // let targetContext = await Cast(proto.targetContext, Doc); - // let sourceContext = await Cast(proto.sourceContext, Doc); - // let self = this; - - - // let dockingFunc = (document: Doc) => { this.props.addDocTab(document, undefined, "inTab"); SelectionManager.DeselectAll(); }; - // if (e.ctrlKey) { - // dockingFunc = (document: Doc) => CollectionDockingView.Instance.AddRightSplit(document, undefined); - // } - - // if (this.props.destinationDoc === self.props.linkDoc.anchor2 && targetContext) { - // DocumentManager.Instance.jumpToDocument(jumpToDoc, e.altKey, false, async document => dockingFunc(document), undefined, targetContext!); - // console.log("1") - // } - // else if (this.props.destinationDoc === self.props.linkDoc.anchor1 && sourceContext) { - // DocumentManager.Instance.jumpToDocument(jumpToDoc, e.altKey, false, document => dockingFunc(sourceContext!)); - // console.log("2") - // } - // else if (DocumentManager.Instance.getDocumentView(jumpToDoc)) { - // DocumentManager.Instance.jumpToDocument(jumpToDoc, e.altKey, undefined, undefined, NumCast((this.props.destinationDoc === self.props.linkDoc.anchor2 ? self.props.linkDoc.anchor2Page : self.props.linkDoc.anchor1Page))); - // console.log("3") - - // } - // else { - // DocumentManager.Instance.jumpToDocument(jumpToDoc, e.altKey, false, dockingFunc); - // console.log("4") - - // } - // } \ No newline at end of file +} \ No newline at end of file -- cgit v1.2.3-70-g09d2