mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-23 12:51:13 +00:00
Open links in a new tab setting in UI
This commit is contained in:
parent
e8dda77d4b
commit
7e01b58ada
3 changed files with 33 additions and 1 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit a241fe1255a6363c7ae1ec5a09520c066745e6ce
|
Subproject commit 7fc71d0860bbe5c6d620ec27112350ffe5b9229c
|
|
@ -72,6 +72,7 @@ interface SettingsState {
|
||||||
show_new_post_notifs?: boolean;
|
show_new_post_notifs?: boolean;
|
||||||
discussion_languages?: number[];
|
discussion_languages?: number[];
|
||||||
generate_totp_2fa?: boolean;
|
generate_totp_2fa?: boolean;
|
||||||
|
open_links_in_new_tab?: boolean;
|
||||||
};
|
};
|
||||||
changePasswordForm: {
|
changePasswordForm: {
|
||||||
new_password?: string;
|
new_password?: string;
|
||||||
|
@ -802,6 +803,23 @@ export class Settings extends Component<any, SettingsState> {
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="input-group mb-3">
|
||||||
|
<div className="form-check">
|
||||||
|
<input
|
||||||
|
className="form-check-input"
|
||||||
|
id="user-open-links-in-new-tab"
|
||||||
|
type="checkbox"
|
||||||
|
checked={this.state.saveUserSettingsForm.open_links_in_new_tab}
|
||||||
|
onChange={linkEvent(this, this.handleOpenInNewTab)}
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
className="form-check-label"
|
||||||
|
htmlFor="user-show-new-post-notifs"
|
||||||
|
>
|
||||||
|
{I18NextService.i18n.t("open_links_in_new_tab")}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{this.totpSection()}
|
{this.totpSection()}
|
||||||
<div className="input-group mb-3">
|
<div className="input-group mb-3">
|
||||||
<button type="submit" className="btn d-block btn-secondary me-4">
|
<button type="submit" className="btn d-block btn-secondary me-4">
|
||||||
|
@ -1044,6 +1062,14 @@ export class Settings extends Component<any, SettingsState> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleOpenInNewTab(i: Settings, event: any) {
|
||||||
|
i.setState(
|
||||||
|
s => (
|
||||||
|
(s.saveUserSettingsForm.open_links_in_new_tab = event.target.checked), s
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
handleShowScoresChange(i: Settings, event: any) {
|
handleShowScoresChange(i: Settings, event: any) {
|
||||||
const mui = UserService.Instance.myUserInfo;
|
const mui = UserService.Instance.myUserInfo;
|
||||||
if (mui) {
|
if (mui) {
|
||||||
|
|
|
@ -759,6 +759,12 @@ 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={
|
||||||
|
UserService.Instance.myUserInfo?.local_user_view.local_user
|
||||||
|
.open_links_in_new_tab ?? false
|
||||||
|
? "_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