Chart Content Blocks
Block 1: Introduction / Definition
Block 2: Key Vocabulary / Steps
Block 3: Examples / Visual Model
HOW TO USE FRACTIONS
Topic: Mathematics | Grade: 4th Grade
What is a Fraction?
Key Vocabulary
Visual Model & Examples
Chart Metadata
Topic: | Grade:
ANCHOR CHART BLUEPRINT: Instructional Reference Guide
I. Chart Structure & Content
II. Style Notes
**Color Scheme:** Primary Header (RED), Section Headings (BLUE), Body Text (BLACK).
**Layout:** Must maintain a clear, numbered hierarchy for procedural steps.
${line}
`).join(''); } } function updateDoc() { const type = document.getElementById('ctrl-type').value; const sections = [1, 2, 3]; sections.forEach(i => { const heading = document.getElementById(`ctrl-heading-${i}`).value; const contentRaw = document.getElementById(`ctrl-content-${i}`).value; document.getElementById(`disp-heading-${i}`).innerText = heading; const contentEl = document.getElementById(`disp-content-${i}`); if (contentRaw.startsWith('1.') || contentRaw.startsWith('2.') || type === 'Steps') { // Assume numbered list (Procedure) contentEl.innerHTML = formatContent(contentRaw, 'Steps'); } else { // Assume paragraph/definitions contentEl.innerHTML = formatContent(contentRaw, 'Paragraph'); } }); } // --- PDF Export --- function generatePDF() { const element = document.getElementById('chart-render-area'); const pdfContainer = document.getElementById('pdf-template'); const pdfContentCopy = document.getElementById('pdf-content-copy'); const title = document.getElementById('cfg-title').value || 'Anchor_Chart'; const filename = `${title.replace(/[^a-z0-9]/gi, '_')}_Blueprint.pdf`; // 1. Copy the formatted content blocks (without the overall wrapper padding) pdfContentCopy.innerHTML = element.innerHTML; // 2. Adjust styling for PDF (removing inner borders/shadows if desired, but keeping colors) // Note: We strip the meta divs from the copied content as they are already handled in the PDF header. pdfContentCopy.querySelector('.chart-title').remove(); pdfContentCopy.querySelector('div[style*="text-align:center"]').remove(); // 3. Generate PDF pdfContainer.style.display = 'block'; const opt = { margin: 0.4, filename: filename, image: { type: 'jpeg', quality: 0.98 }, html2canvas: { scale: 2 }, jsPDF: { unit: 'in', format: 'letter', orientation: 'portrait' } }; html2pdf().set(opt).from(pdfContainer).save().then(() => { // Clean up pdfContainer.style.display = 'none'; // Reload to prevent styling conflicts if user continues editing location.reload(); }); } return { switchTab, updateMeta, updateDoc, generatePDF }; })();