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 { HeartHandshakeIcon } from "lucide-svelte";
|
||||||
import { GITHUB_URL_VERT } from "$lib/consts";
|
import { GITHUB_URL_VERT } from "$lib/consts";
|
||||||
import { m } from "$lib/paraglide/messages";
|
import { m } from "$lib/paraglide/messages";
|
||||||
import { link } from "$lib/paraglide";
|
import { link } from "$lib/store/index.svelte";
|
||||||
|
|
||||||
let { mainContribs, notableContribs, ghContribs } = $props();
|
let { mainContribs, notableContribs, ghContribs } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import { error } from "$lib/logger";
|
import { error } from "$lib/logger";
|
||||||
import { addToast } from "$lib/store/ToastProvider";
|
import { addToast } from "$lib/store/ToastProvider";
|
||||||
import { m } from "$lib/paraglide/messages";
|
import { m } from "$lib/paraglide/messages";
|
||||||
import { link } from "$lib/paraglide";
|
import { link } from "$lib/store/index.svelte";
|
||||||
|
|
||||||
let copied = false;
|
let copied = false;
|
||||||
let timeoutId: number | undefined;
|
let timeoutId: number | undefined;
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import type { ISettings } from "./index.svelte";
|
import type { ISettings } from "./index.svelte";
|
||||||
import { effects } from "$lib/store/index.svelte";
|
import { effects } from "$lib/store/index.svelte";
|
||||||
import { m } from "$lib/paraglide/messages";
|
import { m } from "$lib/paraglide/messages";
|
||||||
import { link } from "$lib/paraglide";
|
import { link } from "$lib/store/index.svelte";
|
||||||
|
|
||||||
const { settings }: { settings: ISettings } = $props();
|
const { settings }: { settings: ISettings } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import Dropdown from "$lib/components/functional/Dropdown.svelte";
|
import Dropdown from "$lib/components/functional/Dropdown.svelte";
|
||||||
import { vertdLoaded } from "$lib/store/index.svelte";
|
import { vertdLoaded } from "$lib/store/index.svelte";
|
||||||
import { m } from "$lib/paraglide/messages";
|
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 vertdCommit = $state<string | null>(null);
|
||||||
let abortController: AbortController | null = null;
|
let abortController: AbortController | null = null;
|
||||||
|
|
|
@ -307,3 +307,33 @@ export function updateLocale(newLocale: string) {
|
||||||
// @ts-expect-error shush
|
// @ts-expect-error shush
|
||||||
locale.set(newLocale);
|
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 clsx from "clsx";
|
||||||
import { AudioLines, BookText, Check, Film, Image } from "lucide-svelte";
|
import { AudioLines, BookText, Check, Film, Image } from "lucide-svelte";
|
||||||
import { m } from "$lib/paraglide/messages";
|
import { m } from "$lib/paraglide/messages";
|
||||||
import { link } from "$lib/paraglide";
|
import { link } from "$lib/store/index.svelte";
|
||||||
|
|
||||||
const getSupportedFormats = (name: string) =>
|
const getSupportedFormats = (name: string) =>
|
||||||
converters
|
converters
|
||||||
|
|
Loading…
Reference in New Issue