From f200719609743ffea8405d9ff159cf415ff0a833 Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Mon, 6 Jul 2020 14:06:02 -0500 Subject: implemented follow behavior options --- src/client/views/linking/LinkEditor.tsx | 9 +++++---- src/client/views/linking/LinkMenu.scss | 7 ++++++- src/client/views/linking/LinkMenuItem.scss | 4 ++++ src/client/views/linking/LinkMenuItem.tsx | 13 ++++++++++++- 4 files changed, 27 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/client/views/linking/LinkEditor.tsx b/src/client/views/linking/LinkEditor.tsx index fbdfda5b3..3adf44339 100644 --- a/src/client/views/linking/LinkEditor.tsx +++ b/src/client/views/linking/LinkEditor.tsx @@ -288,7 +288,7 @@ export class LinkEditor extends React.Component { @observable description = StrCast(LinkManager.currentLink?.description); @observable openDropdown: boolean = false; - @observable currentFollow: string = "Default"; + @observable followBehavior = this.props.linkDoc.follow ? this.props.linkDoc.follow : "Default"; //@observable description = this.props.linkDoc.description ? StrCast(this.props.linkDoc.description) : "DESCRIPTION"; @@ -330,7 +330,8 @@ export class LinkEditor extends React.Component { @action changeFollowBehavior = (follow: string) => { this.openDropdown = false; - this.currentFollow = follow; + this.followBehavior = follow; + this.props.linkDoc.follow = follow; } @computed @@ -340,7 +341,7 @@ export class LinkEditor extends React.Component { Follow Behavior:
- {this.currentFollow} + {this.followBehavior} @@ -348,7 +349,7 @@ export class LinkEditor extends React.Component { {this.openDropdown ?
this.changeFollowBehavior("default")}> + onPointerDown={() => this.changeFollowBehavior("Default")}> Default
{ console.log("FOLLOWWW"); DocumentLinksButton.EditLink = undefined; LinkDocPreview.LinkInfo = undefined; - DocumentManager.Instance.FollowLink(this.props.linkDoc, this.props.sourceDoc, doc => this.props.addDocTab(doc, "onRight"), false); + + if (this.props.linkDoc.follow) { + if (this.props.linkDoc.follow === "Default") { + DocumentManager.Instance.FollowLink(this.props.linkDoc, this.props.sourceDoc, doc => this.props.addDocTab(doc, "onRight"), false); + } else if (this.props.linkDoc.follow === "Always open in right tab") { + this.props.addDocTab(this.props.sourceDoc, "onRight"); + } else if (this.props.linkDoc.follow === "Always open in new tab") { + this.props.addDocTab(this.props.sourceDoc, "inTab"); + } + } else { + DocumentManager.Instance.FollowLink(this.props.linkDoc, this.props.sourceDoc, doc => this.props.addDocTab(doc, "onRight"), false); + } } @action -- cgit v1.2.3-70-g09d2