From d06c01764f54de0860f06943b661566c54082b8b Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Mon, 16 Oct 2023 10:45:15 +0200 Subject: [PATCH] Make sure id doesn't start with a digit --- fragdenstaat_de/fds_cms/static/js/cms/ckeditor.wysiwyg.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fragdenstaat_de/fds_cms/static/js/cms/ckeditor.wysiwyg.js b/fragdenstaat_de/fds_cms/static/js/cms/ckeditor.wysiwyg.js index 518476d51..9b152ef33 100644 --- a/fragdenstaat_de/fds_cms/static/js/cms/ckeditor.wysiwyg.js +++ b/fragdenstaat_de/fds_cms/static/js/cms/ckeditor.wysiwyg.js @@ -92,7 +92,7 @@ CKEDITOR.dtd.$removeEmpty.span = 0; function addSlugId(el) { const innerText = el.children.filter(x => x.type == CKEDITOR.NODE_TEXT).map(x => x.value).join(" ") - const slug = innerText.toLowerCase().replace(/[^-_0-9a-zA-Z]/g, '-'); + const slug = innerText.toLowerCase().replace(/[^-_0-9a-zA-Z]/g, '-').replace(/^(\d+)/, "-$1"); if ((!el.attributes.id) || (el.attributes.id == el.attributes['data-auto-id'])) { el.attributes.id = slug; el.attributes['data-auto-id'] = slug;