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/MainView.tsx | 19 ++- src/client/views/linking/LinkFollowBox.scss | 23 +++ src/client/views/linking/LinkFollowBox.tsx | 28 +++- src/client/views/linking/LinkMenuItem.tsx | 214 ++++------------------------ 4 files changed, 77 insertions(+), 207 deletions(-) (limited to 'src') diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index b49274e7e..d580925d6 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -57,8 +57,6 @@ export class MainView extends React.Component { public overlayTimeout: NodeJS.Timeout | undefined; - @observable private _linkFollowBox = false; - public initiateDictationFade = () => { let duration = DictationManager.Commands.dictationFadeDuration; this.overlayTimeout = setTimeout(() => { @@ -437,17 +435,16 @@ export class MainView extends React.Component { } } - toggleLinkFollowBox = () => { + toggleLinkFollowBox = (shouldClose: boolean) => { if (LinkFollowBox.Instance) { - console.log("is instance!") - // if (LinkFollowBox.Instance.props && LinkFollowBox.Instance.props.removeDocument) LinkFollowBox.Instance.props.removeDocument(LinkFollowBox.Instance.props.Document); + let dvs = DocumentManager.Instance.getDocumentViews(LinkFollowBox.Instance.props.Document); + // if it already exisits, close it + if (dvs.length > 0 && shouldClose) LinkFollowBox.Instance.close(); + // open it if not + else Doc.AddDocToList(Cast(CurrentUserUtils.UserDocument.overlays, Doc) as Doc, "data", LinkFollowBox.Instance.props.Document); } else { - let overlayView = document.getElementById("overlayView"); - let overlayWidth = 0; - if (overlayView) overlayWidth = overlayView.offsetWidth; - let x: number = overlayWidth - 500; - let doc = Docs.Create.LinkFollowBoxDocument({ x: x, y: 20, width: 500, height: 370, title: "Link Follower" }); + let doc = Docs.Create.LinkFollowBoxDocument({ x: this.flyoutWidth, y: 20, width: 500, height: 370, title: "Link Follower" }); Doc.AddDocToList(Cast(CurrentUserUtils.UserDocument.overlays, Doc) as Doc, "data", doc); } } @@ -495,7 +492,7 @@ export class MainView extends React.Component { )} -
  • +
  • +