mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-23 04:41:14 +00:00
also open external links when setting is enabled
This commit is contained in:
parent
4f9c34821f
commit
9f5f81431b
1 changed files with 22 additions and 7 deletions
|
@ -332,6 +332,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
href={url}
|
href={url}
|
||||||
rel={relTags}
|
rel={relTags}
|
||||||
title={url}
|
title={url}
|
||||||
|
target={this.linkTarget}
|
||||||
>
|
>
|
||||||
{this.imgThumb(this.imageSrc)}
|
{this.imgThumb(this.imageSrc)}
|
||||||
<Icon icon="external-link" classes="mini-overlay" />
|
<Icon icon="external-link" classes="mini-overlay" />
|
||||||
|
@ -348,6 +349,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
data-tippy-content={I18NextService.i18n.t("expand_here")}
|
data-tippy-content={I18NextService.i18n.t("expand_here")}
|
||||||
onClick={linkEvent(this, this.handleImageExpandClick)}
|
onClick={linkEvent(this, this.handleImageExpandClick)}
|
||||||
aria-label={I18NextService.i18n.t("expand_here")}
|
aria-label={I18NextService.i18n.t("expand_here")}
|
||||||
|
target={this.linkTarget}
|
||||||
>
|
>
|
||||||
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
||||||
<Icon icon="play" classes="d-flex align-items-center" />
|
<Icon icon="play" classes="d-flex align-items-center" />
|
||||||
|
@ -356,7 +358,13 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<a className="text-body" href={url} title={url} rel={relTags}>
|
<a
|
||||||
|
className="text-body"
|
||||||
|
href={url}
|
||||||
|
title={url}
|
||||||
|
rel={relTags}
|
||||||
|
target={this.linkTarget}
|
||||||
|
>
|
||||||
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
||||||
<Icon icon="external-link" classes="d-flex align-items-center" />
|
<Icon icon="external-link" classes="d-flex align-items-center" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -369,6 +377,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
className="text-body"
|
className="text-body"
|
||||||
to={`/post/${post.id}`}
|
to={`/post/${post.id}`}
|
||||||
title={I18NextService.i18n.t("comments")}
|
title={I18NextService.i18n.t("comments")}
|
||||||
|
target={this.linkTarget}
|
||||||
>
|
>
|
||||||
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
<div className="thumbnail rounded bg-light d-flex justify-content-center">
|
||||||
<Icon icon="message-square" classes="d-flex align-items-center" />
|
<Icon icon="message-square" classes="d-flex align-items-center" />
|
||||||
|
@ -746,6 +755,17 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get linkTarget(): string {
|
||||||
|
if (
|
||||||
|
UserService.Instance.myUserInfo?.local_user_view.local_user
|
||||||
|
.open_links_in_new_tab
|
||||||
|
) {
|
||||||
|
return "_blank";
|
||||||
|
}
|
||||||
|
// _self is the default target on links when the field is not specified
|
||||||
|
return "_self";
|
||||||
|
}
|
||||||
|
|
||||||
get commentsButton() {
|
get commentsButton() {
|
||||||
const post_view = this.postView;
|
const post_view = this.postView;
|
||||||
const title = I18NextService.i18n.t("number_of_comments", {
|
const title = I18NextService.i18n.t("number_of_comments", {
|
||||||
|
@ -759,12 +779,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
title={title}
|
title={title}
|
||||||
to={`/post/${post_view.post.id}?scrollToComments=true`}
|
to={`/post/${post_view.post.id}?scrollToComments=true`}
|
||||||
data-tippy-content={title}
|
data-tippy-content={title}
|
||||||
target={
|
target={this.linkTarget}
|
||||||
UserService.Instance.myUserInfo?.local_user_view.local_user
|
|
||||||
.open_links_in_new_tab
|
|
||||||
? "_blank"
|
|
||||||
: "_self"
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Icon icon="message-square" classes="me-1" inline />
|
<Icon icon="message-square" classes="me-1" inline />
|
||||||
{post_view.counts.comments}
|
{post_view.counts.comments}
|
||||||
|
|
Loading…
Reference in a new issue