import fix in buildLinkField

This commit is contained in:
2026-10-13 23:51:08 +02:00
parent 7572ec0c04
commit 5af5033148
6 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { rowLabel } from 'src/modules/admin-ui/rowLabel.js';
const URL_PATTERN = /^(https?:\/\/|mailto:|tel:|#)/;
import { rowLabel } from '../admin-ui/rowLabel.js';
const URL_PATTERN = /^(?:https?:\/\/|mailto:|tel:|#)/;
/**
* The ONE link shape for a project: a page, an external URL (also mailto:,
* tel:, #anchor) or an uploaded file — plus label, new-tab flag and visual
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -6,7 +6,7 @@
*/ /** Query parameter on the sitemap URL that returns the stylesheet instead of XML. */ export const SITEMAP_STYLE_PARAM = 'style';
export const DEFAULT_SITEMAP_CREDIT = 'Technology by Intecion.com';
/** CSS `content: "…"` value — escapes backslashes, quotes and newlines. */ const cssString = (s)=>`"${s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/[\r\n]+/g, ' ')}"`;
/** Only plain colour values — the option ends up inside a stylesheet. */ const safeColor = (c, fallback)=>c && /^(#[0-9a-f]{3,8}|[a-z]+|(rgb|hsl|oklch)a?\([\d\s.,%/-]+\))$/i.test(c.trim()) ? c.trim() : fallback;
/** Only plain colour values — the option ends up inside a stylesheet. */ const safeColor = (c, fallback)=>c && /^(?:#[0-9a-f]{3,8}|[a-z]+|(?:rgb|hsl|oklch)a?\([\d\s.,%/-]+\))$/i.test(c.trim()) ? c.trim() : fallback;
export function buildSitemapCss({ accent, credit, title } = {}) {
const heading = title?.trim() || 'XML Sitemap';
const note = credit === false ? '' : (credit ?? DEFAULT_SITEMAP_CREDIT).trim();
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -1,6 +1,6 @@
import type { ArrayField, Field, GroupField } from 'payload'
import { rowLabel } from 'src/modules/admin-ui/rowLabel.js'
import { rowLabel } from '../admin-ui/rowLabel.js'
export type LinkAppearance = 'link' | 'primary' | 'secondary'
@@ -18,7 +18,7 @@ export type BuildLinkFieldOptions = {
uploadTo?: string
}
const URL_PATTERN = /^(https?:\/\/|mailto:|tel:|#)/
const URL_PATTERN = /^(?:https?:\/\/|mailto:|tel:|#)/
type SiblingWithType = { type?: string } | undefined
+1 -1
View File
@@ -26,7 +26,7 @@ const cssString = (s: string) => `"${s.replace(/\\/g, '\\\\').replace(/"/g, '\\"
/** Only plain colour values — the option ends up inside a stylesheet. */
const safeColor = (c: string | undefined, fallback: string) =>
c && /^(#[0-9a-f]{3,8}|[a-z]+|(rgb|hsl|oklch)a?\([\d\s.,%/-]+\))$/i.test(c.trim()) ? c.trim() : fallback
c && /^(?:#[0-9a-f]{3,8}|[a-z]+|(?:rgb|hsl|oklch)a?\([\d\s.,%/-]+\))$/i.test(c.trim()) ? c.trim() : fallback
export function buildSitemapCss({ accent, credit, title }: SitemapStyleOptions = {}): string {
const heading = title?.trim() || 'XML Sitemap'