mirror of https://github.com/VERT-sh/VERT.git
fix: oops
This commit is contained in:
parent
bb1715682a
commit
0727e32438
|
@ -3,7 +3,7 @@
|
|||
import { HeartHandshakeIcon } from "lucide-svelte";
|
||||
import { GITHUB_URL_VERT } from "$lib/consts";
|
||||
import { m } from "$lib/paraglide/messages";
|
||||
import { link } from "$lib/paraglide";
|
||||
import { link } from "$lib/store/index.svelte";
|
||||
|
||||
let { mainContribs, notableContribs, ghContribs } = $props();
|
||||
</script>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { error } from "$lib/logger";
|
||||
import { addToast } from "$lib/store/ToastProvider";
|
||||
import { m } from "$lib/paraglide/messages";
|
||||
import { link } from "$lib/paraglide";
|
||||
import { link } from "$lib/store/index.svelte";
|
||||
|
||||
let copied = false;
|
||||
let timeoutId: number | undefined;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
import type { ISettings } from "./index.svelte";
|
||||
import { effects } from "$lib/store/index.svelte";
|
||||
import { m } from "$lib/paraglide/messages";
|
||||
import { link } from "$lib/paraglide";
|
||||
import { link } from "$lib/store/index.svelte";
|
||||
|
||||
const { settings }: { settings: ISettings } = $props();
|
||||
</script>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import Dropdown from "$lib/components/functional/Dropdown.svelte";
|
||||
import { vertdLoaded } from "$lib/store/index.svelte";
|
||||
import { m } from "$lib/paraglide/messages";
|
||||
import { link } from "$lib/paraglide";
|
||||
import { link } from "$lib/store/index.svelte";
|
||||
|
||||
let vertdCommit = $state<string | null>(null);
|
||||
let abortController: AbortController | null = null;
|
||||
|
|
|
@ -306,4 +306,34 @@ export function updateLocale(newLocale: string) {
|
|||
setLocale(newLocale, { reload: false });
|
||||
// @ts-expect-error shush
|
||||
locale.set(newLocale);
|
||||
}
|
||||
|
||||
export function link(
|
||||
tag: string | string[],
|
||||
text: string,
|
||||
links: string | string[],
|
||||
newTab?: boolean | boolean[],
|
||||
className?: string | string[]
|
||||
) {
|
||||
if (!text) return "";
|
||||
|
||||
const tags = Array.isArray(tag) ? tag : [tag];
|
||||
const linksArr = Array.isArray(links) ? links : [links];
|
||||
const newTabArr = Array.isArray(newTab) ? newTab : [newTab];
|
||||
const classArr = Array.isArray(className) ? className : [className];
|
||||
|
||||
let result = text;
|
||||
|
||||
tags.forEach((t, i) => {
|
||||
const link = linksArr[i] ?? "#";
|
||||
const target = newTabArr[i] ? 'target="_blank" rel="noopener noreferrer"' : "";
|
||||
const cls = classArr[i] ? `class="${classArr[i]}"` : "";
|
||||
|
||||
const regex = new RegExp(`\\[${t}\\](.*?)\\[\\/${t}\\]`, "g");
|
||||
result = result.replace(regex, (_, inner) =>
|
||||
`<a href="${link}" ${target} ${cls} >${inner}</a>`
|
||||
);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
|
@ -6,7 +6,7 @@
|
|||
import clsx from "clsx";
|
||||
import { AudioLines, BookText, Check, Film, Image } from "lucide-svelte";
|
||||
import { m } from "$lib/paraglide/messages";
|
||||
import { link } from "$lib/paraglide";
|
||||
import { link } from "$lib/store/index.svelte";
|
||||
|
||||
const getSupportedFormats = (name: string) =>
|
||||
converters
|
||||
|
|
Loading…
Reference in New Issue