refactoring van de cmap structuren bijna compleet

This commit is contained in:
2026-09-03 16:21:21 +02:00
parent 1abc84489f
commit bd1ef6bed0
75 changed files with 2547 additions and 1967 deletions
@@ -11,6 +11,7 @@ export class CmapMetadataDialog {
this.normalizePageReference = normalizePageReference;
this.form = dialog.querySelector("form");
this.summary = dialog.querySelector("#cmap-metadata-summary");
this.namespace = dialog.querySelector("#cmap-metadata-namespace");
this.tags = dialog.querySelector("#cmap-metadata-tags");
this.explanationPage = dialog.querySelector("#cmap-metadata-explanation-page");
this.saveHandler = null;
@@ -31,6 +32,7 @@ export class CmapMetadataDialog {
}
open(metadata) {
this.namespace.value = metadata.namespace || "";
this.summary.value = metadata.summary || "";
this.tags.value = (metadata.tags || []).join(", ");
this.explanationPage.value = metadata.explanationPageSlug || "";
@@ -40,6 +42,14 @@ export class CmapMetadataDialog {
}
metadata() {
const namespace = this.namespace.value.trim().toLocaleLowerCase();
if (namespace && !/^[\p{L}\p{N}][\p{L}\p{N}-]*$/u.test(namespace)) {
this.namespace.setCustomValidity(
this.tr("invalid-concept-map-namespace", "Use letters, numbers and hyphens for the namespace."));
this.namespace.reportValidity();
return null;
}
this.namespace.setCustomValidity("");
const explanationInput = this.explanationPage.value.trim();
const explanationPageSlug = explanationInput ?
this.normalizePageReference(explanationInput) : "";
@@ -50,6 +60,7 @@ export class CmapMetadataDialog {
return null;
}
return {
namespace,
tags: this.tags.value.split(",").map((tag) => tag.trim()).filter(Boolean),
summary: this.summary.value.trim(),
explanationPageSlug