Merge pull request #116 from nathonius/fix/115/popout-window

🐛 fix: #115 Ensure popout windows arent closed when clicking links
This commit is contained in:
Nathan 2024-06-16 14:19:30 -04:00 committed by GitHub
commit 65ab8c207e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 9 deletions

View file

@ -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 { 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";
import { setIssueIcon, setPRIcon, setPRMergeableIcon } from "src/icon";
import { PluginSettings } from "src/plugin";
import { RequestError } from "src/util";
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: [],

View file

@ -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<T> {
header: string;
@ -32,7 +33,7 @@ export const CommonIssuePRColumns: ColumnsMap<IssueSearchResponse["items"][numbe
header: "Number",
cell: (row, el) => {
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<IssueSearchResponse["items"][numbe
el.classList.add("github-link-table-repo");
const url = repoAPIToBrowserUrl(row.repository_url);
const parsed = parseUrl(url);
el.createEl("a", { text: parsed.repo, href: url });
el.createEl("a", { text: parsed.repo, href: url, attr: { target: "_blank" } });
},
},
author: {
header: "Author",
cell: (row, el) => {
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 } });
}

View file

@ -33,6 +33,7 @@ export function renderTable<T extends { items: unknown[] } | unknown[]>(
cls: "github-link-table-refresh-external-link",
text: "View on GitHub",
href: externalLink,
attr: { target: "_blank" },
});
}
const refreshButton = refresh.createEl("button", {