in script.js [58:84]
function addArchetype() {
if (!selectedMgId || !currentData) return;
const value = mgArchetypesInput.value.trim();
if (!value) return;
const index = currentData.management_groups.findIndex(mg => mg.id === selectedMgId);
if (index === -1) return;
// Add the archetype if it doesn't already exist
if (!currentData.management_groups[index].archetypes.includes(value)) {
currentData.management_groups[index].archetypes.push(value);
// Update the UI
renderArchetypeTags(currentData.management_groups[index].archetypes);
// Clear the input
mgArchetypesInput.value = '';
// Only update the JSON preview, no need to re-render the entire tree
// which causes the parent dropdown to reset
updateJsonPreview();
}
// Focus back on the input for rapid addition
mgArchetypesInput.focus();
}