Toon live slug-preview inline naast titel in plaats van los blok

Op verzoek: "Slug: gegenereerde-slug [Aanpassen]" direct onder het
titelveld, waarbij de preview meebeweegt met wat je typt in Titel
(client-side mirror van de backend Slugifier) zolang de slug niet
handmatig is overschreven. Zodra de admin 'm expliciet aanpast en
niet leeg laat, stopt het meebewegen met de titel — consistent met
hoe OfferingsService.UpdateAsync de slug al behandelde.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 15:55:32 +02:00
co-authored by Claude Sonnet 5
parent 1b974696bf
commit d09b3196d8
5 changed files with 65 additions and 16 deletions
+12
View File
@@ -0,0 +1,12 @@
/**
* Client-side mirror of the backend's Slugifier (SlpModularCms.Modules.Offerings.Services.Slugifier)
* — used only for a live preview while typing. The backend remains the source of truth and
* re-normalizes on save, so drift here is a display nit, not a correctness bug.
*/
export function slugifyPreview(value: string): string {
const withoutDiacritics = value.normalize('NFD').replace(/[̀-ͯ]/g, '');
return withoutDiacritics
.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '');
}