From 38091a52e875d58ac313e94b8c1092797d6ee8b0 Mon Sep 17 00:00:00 2001 From: Nathan Smith Date: Sun, 16 Jun 2024 14:16:19 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20#115=20Ensure=20popout=20?= =?UTF-8?q?windows=20arent=20closed=20when=20clicking=20links?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also added the actual url to an authors page when rendering it in the table. Closes: #115 --- src/inline/inline.ts | 10 +++++----- src/query/column/base.ts | 13 +++++++++---- src/query/output.ts | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/inline/inline.ts b/src/inline/inline.ts index 8ece345..f121012 100644 --- a/src/inline/inline.ts +++ b/src/inline/inline.ts @@ -1,13 +1,13 @@ -import type { PullResponse } from "src/github/response"; import { IssueStatus, getIssueStatus, getPRStatus } from "src/github/response"; import { getIssue, getPullRequest } from "../github/github"; +import { setIssueIcon, setPRIcon, setPRMergeableIcon } from "src/icon"; import type { ParsedUrl } from "../github/url-parse"; -import { parseUrl } from "../github/url-parse"; -import { setIcon } from "obsidian"; -import { setIssueIcon, setPRIcon, setPRMergeableIcon } from "src/icon"; import { PluginSettings } from "src/plugin"; +import type { PullResponse } from "src/github/response"; import { RequestError } from "src/util"; +import { parseUrl } from "../github/url-parse"; +import { setIcon } from "obsidian"; interface TagConfig { icon: HTMLSpanElement; @@ -16,7 +16,7 @@ interface TagConfig { export function createTag(href: string): HTMLAnchorElement { const parsedUrl = parseUrl(href); - const container = createEl("a", { cls: "github-link-inline", href }); + const container = createEl("a", { cls: "github-link-inline", href, attr: { target: "_blank" } }); const config: TagConfig = { icon: createSpan({ cls: ["github-link-status-icon", "github-link-inline-icon"] }), sections: [], diff --git a/src/query/column/base.ts b/src/query/column/base.ts index 0f7a579..b8c20cc 100644 --- a/src/query/column/base.ts +++ b/src/query/column/base.ts @@ -1,6 +1,7 @@ -import type { IssueSearchResponse } from "src/github/response"; import { parseUrl, repoAPIToBrowserUrl } from "src/github/url-parse"; + import { DateFormat } from "src/util"; +import type { IssueSearchResponse } from "src/github/response"; export interface ColumnGetter { header: string; @@ -32,7 +33,7 @@ export const CommonIssuePRColumns: ColumnsMap { el.classList.add("github-link-table-issue-number"); - el.createEl("a", { text: `#${row.number}`, href: row.html_url }); + el.createEl("a", { text: `#${row.number}`, href: row.html_url, attr: { target: "_blank" } }); }, }, repo: { @@ -41,13 +42,17 @@ export const CommonIssuePRColumns: ColumnsMap { - const anchor = el.createEl("a", { cls: "github-link-table-author" }); + const anchor = el.createEl("a", { + cls: "github-link-table-author", + href: row.user?.html_url, + attr: { target: "_blank" }, + }); if (row.user?.avatar_url) { anchor.createEl("img", { cls: "github-link-table-avatar", attr: { src: row.user.avatar_url } }); } diff --git a/src/query/output.ts b/src/query/output.ts index fdacdf3..a653479 100644 --- a/src/query/output.ts +++ b/src/query/output.ts @@ -33,6 +33,7 @@ export function renderTable( cls: "github-link-table-refresh-external-link", text: "View on GitHub", href: externalLink, + attr: { target: "_blank" }, }); } const refreshButton = refresh.createEl("button", {