Skip to content

Commit

Permalink
fix issue with opening links from text
Browse files Browse the repository at this point in the history
  • Loading branch information
SLS\niklil committed Mar 9, 2020
1 parent 3e7f4df commit 313f7c8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/comments/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export class CommentsComponent {
this.renderer.listen(this.elementRef.nativeElement, 'click', (event) => {

event.stopPropagation();
event.preventDefault();
// This is tagging in href to another page e.g. introduction
try {
const elem: HTMLElement = event.target as HTMLElement;
Expand All @@ -107,11 +108,11 @@ export class CommentsComponent {
// Also check if already open and if same publication?
if ( elem.classList !== undefined ) {
const list = elem.classList;
if ( list.contains('ref_introduction') ) {
if ( list.contains('introduction') ) {
this.openNewIntro(event, {id: String(elem.getAttribute('href')).split('#')[0].trim()});
} else if ( list.contains('ref_readingtext') ) {
} else if ( list.contains('readingtext') ) {
this.openNewView(event, String(elem.getAttribute('href')).split('#')[0].trim(), 'established');
} else if ( list.contains('ref_comment') ) {
} else if ( list.contains('comment') ) {
this.openNewView(event, String(elem.getAttribute('href')).split('#')[0].trim(), 'comments');
}
}
Expand All @@ -122,6 +123,8 @@ export class CommentsComponent {
this.scrollToHTMLElement(target, false);
}
}.bind(this), 500);
} else if ( elem.classList !== undefined && elem.classList.contains('ext') ) {
const ref = window.open(elem.href, '_blank', 'location=no');
}
} catch ( e ) {}

Expand Down

0 comments on commit 313f7c8

Please sign in to comment.