Removed the Module Library, no longer necessary

This commit is contained in:
Nathan Schneider
2025-05-07 22:21:30 -06:00
parent adf155e954
commit 41aeffa81b
17 changed files with 94 additions and 1323 deletions

View File

@ -58,7 +58,7 @@
</select>
</div>
<textarea id="{{ .id }}" name="{{ .id }}" placeholder="{{ .placeholder }}" {{ if .required }}required{{ end }}></textarea>
<textarea id="{{ .id }}" name="{{ .id }}" {{ if .required }}required{{ end }} rows="2" style="min-height: 60px; overflow: hidden;"></textarea>
</div>
{{ end }}
</div>
@ -165,6 +165,8 @@ document.addEventListener('DOMContentLoaded', function() {
});
});
// Textarea auto-resizing is now handled by the script in head.html
// Export dropdown removed (moved to sidebar)
// Preview Mode Toggle

View File

@ -1,36 +0,0 @@
{{ define "main" }}
<div class="container">
<div class="page-header">
<h1>{{ .Title }}</h1>
<p>{{ .Description }}</p>
</div>
<div class="content">
{{ .Content }}
</div>
<div class="search-filter">
<input type="text" id="module-search" placeholder="Search modules...">
<select id="stage-filter">
<option value="">All Stages</option>
</select>
<select id="component-filter">
<option value="">All Components</option>
</select>
<select id="template-filter">
<option value="">All Templates</option>
</select>
</div>
<div id="modules-container" class="modules-container">
<!-- Modules will be loaded here via JavaScript -->
<div class="loading">Loading modules...</div>
</div>
</div>
<!-- Load the module data -->
<script src="{{ "js/data/modules.js" | relURL }}"></script>
<script src="{{ "js/data/templates.js" | relURL }}"></script>
<script src="{{ "js/data/template-mapper.js" | relURL }}"></script>
<script src="{{ "js/modules-page.js" | relURL }}"></script>
{{ end }}

View File

@ -18,6 +18,82 @@
<script defer src="{{ "js/debug.js" | relURL }}"></script>
<script type="module" src="{{ "js/templates/index.js" | relURL }}"></script>
<script type="module" src="{{ "js/builder.js" | relURL }}"></script>
<!-- Auto-resize textareas script -->
<script>
// Ensure this runs before other scripts
window.addEventListener('DOMContentLoaded', function() {
// Function to resize textarea to fit content
function autoResizeTextarea(textarea) {
// Reset height temporarily to get the correct scrollHeight
textarea.style.height = 'auto';
// Set to scrollHeight + padding
textarea.style.height = Math.max(textarea.scrollHeight + 10, 60) + 'px';
}
// Setup resize on all textareas
function setupTextareaResizing() {
const textareas = document.querySelectorAll('textarea');
textareas.forEach(function(textarea) {
// Initial sizing
autoResizeTextarea(textarea);
// Resize on input
textarea.addEventListener('input', function() {
autoResizeTextarea(this);
});
// Handle value changes via all possible methods
let lastValue = textarea.value;
// Create mutation observer to watch for DOM changes affecting the textarea
const observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (textarea.value !== lastValue) {
lastValue = textarea.value;
autoResizeTextarea(textarea);
}
});
});
// Configure and start the observer
observer.observe(textarea, {
attributes: true,
attributeFilter: ['value'],
characterData: true,
subtree: true
});
// Also check periodically as a fallback for template applications
const valueChecker = setInterval(function() {
if (textarea.value !== lastValue) {
lastValue = textarea.value;
autoResizeTextarea(textarea);
}
}, 50); // More frequent checks
// Store the interval ID to avoid memory leaks
textarea.dataset.checkerInterval = valueChecker;
});
}
// Run setup immediately
setupTextareaResizing();
// Also run after a slight delay to catch any content loaded asynchronously
setTimeout(setupTextareaResizing, 100);
setTimeout(setupTextareaResizing, 500);
setTimeout(setupTextareaResizing, 1000);
// Add listener for template application
document.addEventListener('templateApplied', function() {
console.log('Template applied, resizing all textareas');
document.querySelectorAll('textarea').forEach(autoResizeTextarea);
});
});
</script>
{{ end }}
<!-- Additional custom JS from site parameters -->

View File

@ -7,7 +7,6 @@
<ul>
<li><a href="{{ "/" | relURL }}">Home</a></li>
<li><a href="{{ "builder/" | relURL }}">Protocol Builder</a></li>
<li><a href="{{ "modules/" | relURL }}">Modules Library</a></li>
<li><a href="{{ "about/" | relURL }}">About</a></li>
</ul>
</nav>