Fixed issue with JS vs. YAML content location, and link styling

This commit is contained in:
Nathan Schneider
2025-11-14 12:27:29 -07:00
parent 847b603734
commit 9bb5739568
15 changed files with 163 additions and 712 deletions

View File

@@ -534,10 +534,20 @@ document.addEventListener('DOMContentLoaded', function() {
console.error('Cannot apply template: template is null or undefined');
return;
}
console.log('Applying template:', selectedTemplate.title);
console.log('Template data structure:', selectedTemplate);
// Clear all textareas before applying the new template
// This ensures that fields from a previous template are not left behind
document.querySelectorAll('textarea').forEach(textarea => {
// Skip the protocol summary textarea as we'll set it separately
if (textarea.id !== 'protocol-summary') {
textarea.value = '';
}
});
console.log('Cleared all field textareas before applying template');
// Reset protocol data while preserving metadata
protocol = {
metadata: {
@@ -549,7 +559,7 @@ document.addEventListener('DOMContentLoaded', function() {
templateTitle: selectedTemplate.title,
templateDescription: selectedTemplate.description
};
// Always use the template description for summary when applying a template
protocolSummaryTextarea.value = selectedTemplate.description;
protocol.metadata.summary = selectedTemplate.description;