diff options
author | Melissa Zhang <mzhang19096@gmail.com> | 2020-07-30 10:37:16 -0700 |
---|---|---|
committer | Melissa Zhang <mzhang19096@gmail.com> | 2020-07-30 10:37:16 -0700 |
commit | 5b348d21a79a7ecd9ac30d808edaa03c3f26dfef (patch) | |
tree | b9c8b9029c9b574708a3fb673b9924dde9673873 /src/client/views/linking/LinkMenuItem.tsx | |
parent | 7ced683e2c0bbc1b666e0b01799788810cebfd98 (diff) |
added option to follow link to external page
Diffstat (limited to 'src/client/views/linking/LinkMenuItem.tsx')
-rw-r--r-- | src/client/views/linking/LinkMenuItem.tsx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/client/views/linking/LinkMenuItem.tsx b/src/client/views/linking/LinkMenuItem.tsx index 475133010..079e130ea 100644 --- a/src/client/views/linking/LinkMenuItem.tsx +++ b/src/client/views/linking/LinkMenuItem.tsx @@ -153,15 +153,20 @@ export class LinkMenuItem extends React.Component<LinkMenuItemProps> { async followDefault() { DocumentLinksButton.EditLink = undefined; LinkDocPreview.LinkInfo = undefined; + const linkDoc = this.props.linkDoc; - if (this.props.linkDoc.followLinkLocation && this.props.linkDoc.followLinkLocation !== "Default") { - this.props.addDocTab(this.props.destinationDoc, StrCast(this.props.linkDoc.followLinkLocation)); + if (linkDoc.followLinkLocation === "openExternal" && this.props.destinationDoc.type === DocumentType.WEB) { + window.open(Hypothesis.makeAnnotationUrl(StrCast(this.props.linkDoc.annotationId), '_blank')); + return; + } + + if (linkDoc.followLinkLocation && linkDoc.followLinkLocation !== "Default") { + this.props.addDocTab(this.props.destinationDoc, StrCast(linkDoc.followLinkLocation)); } else { DocumentManager.Instance.FollowLink(this.props.linkDoc, this.props.sourceDoc, doc => this.props.addDocTab(doc, "onRight"), false); } - // this.props.linkDoc.linksToAnnotation && setTimeout(() => window.open(StrCast(this.props.linkDoc.annotationUrl), '_blank'), 1000); // open external page if hypothes.is annotation - this.props.linkDoc.linksToAnnotation && Hypothesis.scrollToAnnotation(StrCast(this.props.linkDoc.annotationId)); + linkDoc.linksToAnnotation && Hypothesis.scrollToAnnotation(StrCast(this.props.linkDoc.annotationId)); } @undoBatch |