diff options
author | monikahedman <monika_hedman@brown.edu> | 2019-08-27 18:48:14 -0400 |
---|---|---|
committer | monikahedman <monika_hedman@brown.edu> | 2019-08-27 18:48:14 -0400 |
commit | f204675b5b952fd9fdf301c41d702cfe1f5633e3 (patch) | |
tree | 744ea26586fb89eddca93adcc36e188574de8f0f /src/client/views/linking/LinkMenuItem.tsx | |
parent | c1adf10630a4fd163c1c9ef11abf9ad090bf29a3 (diff) |
works i think
Diffstat (limited to 'src/client/views/linking/LinkMenuItem.tsx')
-rw-r--r-- | src/client/views/linking/LinkMenuItem.tsx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/client/views/linking/LinkMenuItem.tsx b/src/client/views/linking/LinkMenuItem.tsx index 1210d7198..0ae578d5a 100644 --- a/src/client/views/linking/LinkMenuItem.tsx +++ b/src/client/views/linking/LinkMenuItem.tsx @@ -90,23 +90,30 @@ export class LinkMenuItem extends React.Component<LinkMenuItemProps> { onContextMenu = (e: React.MouseEvent) => { e.preventDefault(); - ContextMenu.Instance.addItem({ description: "Open in Link Follower", event: () => console.log("opening 1!"), icon: "link" }); + ContextMenu.Instance.addItem({ description: "Open in Link Follower", event: () => this.openLinkFollower(), icon: "link" }); ContextMenu.Instance.addItem({ description: "Follow Default Link", event: () => this.followDefault(), icon: "arrow-right" }); ContextMenu.Instance.displayMenu(e.clientX, e.clientY); } - followDefault = () => { + @action.bound + async followDefault() { if (LinkFollowBox.Instance === undefined) { - let doc = Docs.Create.LinkFollowBoxDocument({ x: MainView.Instance.flyoutWidth, y: 20, width: 500, height: 370, title: "Link Follower" }); - Doc.AddDocToList(Cast(CurrentUserUtils.UserDocument.overlays, Doc) as Doc, "data", doc); + let doc = await Docs.Create.LinkFollowBoxDocument({ x: MainView.Instance.flyoutWidth, y: 20, width: 500, height: 370, title: "Link Follower" }); + await Doc.AddDocToList(Cast(CurrentUserUtils.UserDocument.overlays, Doc) as Doc, "data", doc); } LinkFollowBox.Instance.setLinkDocs(this.props.linkDoc, this.props.sourceDoc, this.props.destinationDoc); LinkFollowBox.Instance.defaultLinkBehavior(); } - openLinkFollower = () => { + @action.bound + async openLinkFollower() { + if (LinkFollowBox.Instance === undefined) { + let doc = await Docs.Create.LinkFollowBoxDocument({ x: MainView.Instance.flyoutWidth, y: 20, width: 500, height: 370, title: "Link Follower" }); + await Doc.AddDocToList(Cast(CurrentUserUtils.UserDocument.overlays, Doc) as Doc, "data", doc); + } else { + MainView.Instance.toggleLinkFollowBox(false); + } LinkFollowBox.Instance.setLinkDocs(this.props.linkDoc, this.props.sourceDoc, this.props.destinationDoc); - MainView.Instance.toggleLinkFollowBox(false); } render() { |