Examups commited on
Commit
60ca6d2
·
verified ·
1 Parent(s): 105f246

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +101 -27
index.html CHANGED
@@ -1,4 +1,3 @@
1
-
2
  <!DOCTYPE html>
3
  <html lang="en">
4
  <head>
@@ -144,9 +143,6 @@
144
  gap: 0.25rem;
145
  margin-bottom: 0.5rem;
146
  }
147
- .item-toolbar button {
148
- line-height: 1;
149
- }
150
  .layout-item {
151
  cursor: move;
152
  }
@@ -1649,7 +1645,7 @@
1649
  :root { --sidebar-width: 260px; --primary-color: ${colors.primary}; --secondary-color: ${colors.secondary}; --text-color: ${colors.text}; --heading-color: ${colors.heading}; --font-family: ${typography.fontFamily}; }
1650
  body { font-family: var(--font-family); color: var(--text-color); margin: 0; background-color: #f0f2f5; }
1651
  h1,h2,h3,h4,h5,h6 { color: var(--heading-color); }
1652
- .container { max-width: 1280px; margin: 0 auto; width: 90%; } a { color: var(--primary-color); }
1653
  .main-content-pusher { transition: margin-left 0.3s ease-in-out; }
1654
  @keyframes gift-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
1655
  @keyframes button-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 152, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); } }
@@ -1662,18 +1658,21 @@ h1,h2,h3,h4,h5,h6 { color: var(--heading-color); }
1662
  css.lmsHeader = `
1663
  .learning-app-header-container { background-color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.05); z-index: 100; position: relative; }
1664
  .learning-app-header-container.sticky-header { position: sticky; top: 0; z-index: 1010; }
1665
- .lms-primary-bar { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; height: 60px; }
1666
  .lms-brand { display: flex; align-items: center; gap: 1rem; }
1667
- .hamburger-menu { background: none; border: none; font-size: 1.5rem; cursor: pointer; }
 
1668
  .app-name { font-weight: 700; font-size: 1.25rem; }
1669
  .lms-icon-group { display: flex; align-items: center; gap: 0.25rem; }
1670
- .icon-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; font-size: 1.2rem; cursor: pointer; position: relative; width: 40px; height: 40px; border-radius: 50%; }
1671
- .notification-bell .badge { position: absolute; top: 5px; right: 5px; background-color: #ef4444; color: #fff; font-size: 0.65rem; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
1672
- .lms-page-title { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; border-top: 1px solid #e5e7eb; }
 
 
1673
  .lms-page-title h2 { font-size: 1.125rem; font-weight: 600; margin: 0; }
1674
- .lms-tabs-nav { display: flex; overflow-x: auto; padding: 0 1rem; border-top: 1px solid #e5e7eb; }
1675
- .lms-tab-item { padding: 0.75rem 1rem; font-size: 0.9rem; color: #6b7280; white-space: nowrap; border-bottom: 2px solid transparent; }
1676
- .lms-tab-item.active { color: var(--primary-color); font-weight: 600; border-bottom-color: var(--primary-color); }
1677
  .lms-search-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(243, 244, 246, 0.8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out; }
1678
  body.search-active .lms-search-overlay { opacity: 1; visibility: visible; }
1679
  .lms-search-content { text-align: center; }
@@ -1686,22 +1685,32 @@ body.search-active .lms-search-overlay { opacity: 1; visibility: visible; }
1686
  .lms-search-form button:hover { background-color: #f3f4f6; }
1687
  .search-suggestions { margin-top: 1.5rem; color: #4b5563; }
1688
  .search-suggestions span { margin-right: 10px; }
1689
- .search-suggestions a { display: inline-block; color: #374151; text-decoration: none; border: 1px solid #d1d5db; padding: 5px 12px; border-radius: 20px; margin: 0 5px; transition: all 0.3s ease; }
1690
  .search-suggestions a:hover { background-color: #374151; color: #fff; border-color: #374151; }
 
1691
  @media (max-width: 768px) { .lms-bonus-icon, .lms-custom-icon { display: none; } .lms-brand .app-name { display: none; } }`;
1692
  css.sidebar = config.sidebar.enabled ? `
1693
  .lms-sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width); background-color: #fff; z-index: 2000; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 0.3s ease-in-out; border-right: 1px solid #e5e7eb; }
1694
  .lms-sidebar-overlay { position: fixed; inset: 0; background-color: rgba(0,0,0,0.5); z-index: 1999; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
1695
  body.sidebar-open .lms-sidebar { transform: translateX(0); }
1696
  @media (max-width: 1023px) { body.sidebar-open .lms-sidebar-overlay { opacity: 1; visibility: visible; } }
1697
- .lms-sidebar-brand { display: flex; align-items: center; padding: 1rem; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
1698
- .lms-sidebar-logo { height: 40px; } .lms-sidebar-sitename { margin-left: 0.75rem; }
1699
- .lms-sidebar-toggle { background: none; border: none; font-size: 1.25rem; cursor: pointer; margin-left: auto; }
1700
  .lms-sidebar-content { flex-grow: 1; overflow-y: auto; padding: 0.5rem; }
1701
- .lms-sidebar-nav { border-bottom: 1px solid #e5e7eb; padding-bottom: 0.5rem; margin-bottom: 0.5rem; }
1702
- .lms-sidebar-nav:last-child { border: none; }
1703
- .lms-sidebar-nav ul li a { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem; border-radius: 6px; }
 
 
1704
  .sidebar-badge { margin-left: auto; background-color: var(--primary-color); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; }
 
 
 
 
 
 
 
1705
  .lms-sidebar-footer { padding: 0.5rem; border-top: 1px solid #e5e7eb; flex-shrink: 0; }` : '';
1706
  css.footer = `
1707
  .site-footer { background-color: #1f2937; color: #d1d5db; padding: 60px 0 20px; font-size: 14px; }
@@ -1766,9 +1775,15 @@ body.sidebar-open .lms-sidebar { transform: translateX(0); }
1766
  document.getElementById('lms-sidebar-collapse-btn')?.addEventListener('click', sidebarToggle);
1767
 
1768
  document.querySelectorAll('.lms-sidebar-nav-accordion .accordion-trigger').forEach(trigger => {
1769
- trigger.addEventListener('click', () => {
 
1770
  const panel = trigger.nextElementSibling;
1771
- panel.style.maxHeight = panel.style.maxHeight ? null : panel.scrollHeight + 'px';
 
 
 
 
 
1772
  });
1773
  });
1774
 
@@ -1806,7 +1821,9 @@ body.sidebar-open .lms-sidebar { transform: translateX(0); }
1806
  let js = getFullJS();
1807
  if (js.trim()) js = `document.addEventListener('DOMContentLoaded', () => { \n${js.trim()} \n});`;
1808
 
1809
- return `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Exported Page</title><script src="https://cdn.tailwindcss.com"><\/script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"><link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet"><style>${css}</style></head><body class="bg-gray-100">${sidebar}<div class="main-content-pusher">${main}</div>${mobileFooter}${js ? `<script>${js}<\/script>` : ''}</body></html>`;
 
 
1810
  }
1811
 
1812
  // --- Rendering ---
@@ -1847,9 +1864,10 @@ body.sidebar-open .lms-sidebar { transform: translateX(0); }
1847
  function generatePageZip() {
1848
  const zip = new JSZip();
1849
  const { sidebar, main, mobileFooter } = getAllHtml();
1850
- const html = `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Exported Page</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"><link rel="stylesheet" href="style.css"></head><body>${sidebar}<div class="main-content-pusher">${main}</div>${mobileFooter}<script src="script.js"><\/script></body></html>`;
1851
  const css = getFullCSS();
1852
  const js = getFullJS();
 
 
1853
 
1854
  zip.file("index.html", html);
1855
  zip.file("style.css", css);
@@ -1857,10 +1875,59 @@ body.sidebar-open .lms-sidebar { transform: translateX(0); }
1857
 
1858
  zip.generateAsync({type:"blob"}).then(content => { saveAs(content, "exported-page.zip"); showToast("ZIP file generated!"); });
1859
  }
 
 
 
 
1860
  function handleFileImport(event) {
1861
- showToast('Import function is a placeholder in this version.');
1862
- event.target.value = null;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1863
  }
 
1864
  function handleGetCodeClick(e) {
1865
  const button = e.target.closest('.get-component-code-btn');
1866
  if (!button) return;
@@ -1950,7 +2017,13 @@ body.sidebar-open .lms-sidebar { transform: translateX(0); }
1950
  ui.mobileFooter.cta.text.value = config.mobileFooter.cta.text;
1951
  ui.mobileFooter.support.toggle.checked = config.mobileFooter.support.enabled;
1952
 
1953
- setupEventListeners();
 
 
 
 
 
 
1954
 
1955
  // Initial renders for dynamic controls
1956
  toggleLmsBrandControls();
@@ -1970,6 +2043,7 @@ body.sidebar-open .lms-sidebar { transform: translateX(0); }
1970
 
1971
  renderLayoutControls();
1972
  renderAll();
 
1973
  if(!document.querySelector('.control-nav-button.active')){
1974
  ui.controls.nav.querySelector('.control-nav-button').click();
1975
  }
 
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
  <head>
 
143
  gap: 0.25rem;
144
  margin-bottom: 0.5rem;
145
  }
 
 
 
146
  .layout-item {
147
  cursor: move;
148
  }
 
1645
  :root { --sidebar-width: 260px; --primary-color: ${colors.primary}; --secondary-color: ${colors.secondary}; --text-color: ${colors.text}; --heading-color: ${colors.heading}; --font-family: ${typography.fontFamily}; }
1646
  body { font-family: var(--font-family); color: var(--text-color); margin: 0; background-color: #f0f2f5; }
1647
  h1,h2,h3,h4,h5,h6 { color: var(--heading-color); }
1648
+ .container { max-width: 1280px; margin: 0 auto; width: 90%; } a { color: var(--primary-color); text-decoration: none; }
1649
  .main-content-pusher { transition: margin-left 0.3s ease-in-out; }
1650
  @keyframes gift-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
1651
  @keyframes button-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(255, 152, 0, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); } }
 
1658
  css.lmsHeader = `
1659
  .learning-app-header-container { background-color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.05); z-index: 100; position: relative; }
1660
  .learning-app-header-container.sticky-header { position: sticky; top: 0; z-index: 1010; }
1661
+ .lms-primary-bar { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; height: 60px; border-bottom: 1px solid #e5e7eb; }
1662
  .lms-brand { display: flex; align-items: center; gap: 1rem; }
1663
+ .hamburger-menu { background: none; border: none; font-size: 1.5rem; cursor: pointer; display: none; }
1664
+ .lms-logo { height: 30px; }
1665
  .app-name { font-weight: 700; font-size: 1.25rem; }
1666
  .lms-icon-group { display: flex; align-items: center; gap: 0.25rem; }
1667
+ .icon-btn { display: inline-flex; align-items: center; justify-content: center; background: none; border: none; color: #4b5563; font-size: 1.2rem; cursor: pointer; position: relative; width: 40px; height: 40px; border-radius: 50%; transition: background-color 0.2s, color 0.2s; }
1668
+ .icon-btn:hover { background-color: #f3f4f6; color: var(--primary-color); }
1669
+ .notification-bell .badge { position: absolute; top: 5px; right: 5px; background-color: #ef4444; color: #fff; font-size: 0.65rem; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 500; }
1670
+ .lms-page-title { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background-color: #fafafa; border-bottom: 1px solid #e5e7eb;}
1671
+ .back-btn { background: none; border: 1px solid #d1d5db; border-radius: 50%; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
1672
  .lms-page-title h2 { font-size: 1.125rem; font-weight: 600; margin: 0; }
1673
+ .lms-tabs-nav { display: flex; overflow-x: auto; padding: 0 1rem; border-bottom: 1px solid #e5e7eb; background: #fff;}
1674
+ .lms-tab-item { padding: 0.75rem 1rem; font-size: 0.9rem; color: #6b7280; white-space: nowrap; border-bottom: 2px solid transparent; transition: all 0.2s; }
1675
+ .lms-tab-item.active, .lms-tab-item:hover { color: var(--primary-color); font-weight: 600; border-bottom-color: var(--primary-color); }
1676
  .lms-search-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(243, 244, 246, 0.8); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s ease-in-out; }
1677
  body.search-active .lms-search-overlay { opacity: 1; visibility: visible; }
1678
  .lms-search-content { text-align: center; }
 
1685
  .lms-search-form button:hover { background-color: #f3f4f6; }
1686
  .search-suggestions { margin-top: 1.5rem; color: #4b5563; }
1687
  .search-suggestions span { margin-right: 10px; }
1688
+ .search-suggestions a { display: inline-block; color: #374151; text-decoration: none; border: 1px solid #d1d5db; padding: 5px 12px; border-radius: 20px; margin: 0 5px; transition: all 0.3s ease; font-size: 0.9rem; }
1689
  .search-suggestions a:hover { background-color: #374151; color: #fff; border-color: #374151; }
1690
+ @media (max-width: 1023px) { .hamburger-menu { display: block; } }
1691
  @media (max-width: 768px) { .lms-bonus-icon, .lms-custom-icon { display: none; } .lms-brand .app-name { display: none; } }`;
1692
  css.sidebar = config.sidebar.enabled ? `
1693
  .lms-sidebar { position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-width); background-color: #fff; z-index: 2000; display: flex; flex-direction: column; transform: translateX(-100%); transition: transform 0.3s ease-in-out; border-right: 1px solid #e5e7eb; }
1694
  .lms-sidebar-overlay { position: fixed; inset: 0; background-color: rgba(0,0,0,0.5); z-index: 1999; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
1695
  body.sidebar-open .lms-sidebar { transform: translateX(0); }
1696
  @media (max-width: 1023px) { body.sidebar-open .lms-sidebar-overlay { opacity: 1; visibility: visible; } }
1697
+ .lms-sidebar-brand { display: flex; align-items: center; padding: 1rem; height: 60px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
1698
+ .lms-sidebar-logo { height: 40px; object-fit: contain; } .lms-sidebar-sitename { margin-left: 0.75rem; line-height: 1.2; } .lms-sidebar-sitename strong { font-weight: 600; } .lms-sidebar-sitename small { font-size: 0.8rem; color: #6b7280; }
1699
+ .lms-sidebar-toggle { background: none; border: 1px solid #d1d5db; font-size: 1rem; cursor: pointer; margin-left: auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items:center; }
1700
  .lms-sidebar-content { flex-grow: 1; overflow-y: auto; padding: 0.5rem; }
1701
+ .lms-sidebar-nav, .lms-sidebar-nav-accordion { border-bottom: 1px solid #e5e7eb; padding: 0.5rem 0; margin-bottom: 0.5rem; }
1702
+ .lms-sidebar-nav:last-child, .lms-sidebar-nav-accordion:last-child { border: none; }
1703
+ .lms-sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
1704
+ .lms-sidebar-nav ul li a { display: flex; align-items: center; gap: 0.85rem; padding: 0.65rem; border-radius: 6px; font-weight: 500; color: #374151; } .lms-sidebar-nav ul li a:hover { background-color: #f3f4f6; }
1705
+ .lms-sidebar-nav ul li a i { width: 20px; text-align: center; color: #9ca3af; }
1706
  .sidebar-badge { margin-left: auto; background-color: var(--primary-color); color: white; font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; }
1707
+ .accordion-trigger { display: flex; justify-content: space-between; align-items: center; width: 100%; background: none; border: none; cursor: pointer; padding: 0.65rem; font-weight: 500; color: #374151; }
1708
+ .accordion-trigger div { display: flex; align-items: center; gap: 0.85rem; }
1709
+ .accordion-trigger i { width: 20px; text-align: center; color: #9ca3af; } .accordion-trigger .arrow { transition: transform 0.3s ease; }
1710
+ .accordion-trigger.active .arrow { transform: rotate(180deg); }
1711
+ .accordion-panel { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
1712
+ .accordion-panel .lms-sidebar-nav { border: none; padding: 0; margin: 0; }
1713
+ .accordion-panel .lms-sidebar-nav ul { padding-left: 1.5rem; }
1714
  .lms-sidebar-footer { padding: 0.5rem; border-top: 1px solid #e5e7eb; flex-shrink: 0; }` : '';
1715
  css.footer = `
1716
  .site-footer { background-color: #1f2937; color: #d1d5db; padding: 60px 0 20px; font-size: 14px; }
 
1775
  document.getElementById('lms-sidebar-collapse-btn')?.addEventListener('click', sidebarToggle);
1776
 
1777
  document.querySelectorAll('.lms-sidebar-nav-accordion .accordion-trigger').forEach(trigger => {
1778
+ trigger.addEventListener('click', (e) => {
1779
+ e.preventDefault();
1780
  const panel = trigger.nextElementSibling;
1781
+ trigger.classList.toggle('active');
1782
+ if (panel.style.maxHeight) {
1783
+ panel.style.maxHeight = null;
1784
+ } else {
1785
+ panel.style.maxHeight = panel.scrollHeight + 'px';
1786
+ }
1787
  });
1788
  });
1789
 
 
1821
  let js = getFullJS();
1822
  if (js.trim()) js = `document.addEventListener('DOMContentLoaded', () => { \n${js.trim()} \n});`;
1823
 
1824
+ const configScript = `<script id="app-config" type="application/json">${JSON.stringify(config, null, 2)}<\/script>`;
1825
+
1826
+ return `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Exported Page</title><script src="https://cdn.tailwindcss.com"><\/script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"><link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Roboto:wght@400;500;700&family=Open+Sans:wght@400;700&family=Lato:wght@400;700&family=Montserrat:wght@400;700&family=Poppins:wght@400;500;600;700&display=swap" rel="stylesheet"><style>${css}</style></head><body class="bg-gray-100">${sidebar}<div class="main-content-pusher">${main}</div>${mobileFooter}${configScript}${js ? `<script>${js}<\/script>` : ''}</body></html>`;
1827
  }
1828
 
1829
  // --- Rendering ---
 
1864
  function generatePageZip() {
1865
  const zip = new JSZip();
1866
  const { sidebar, main, mobileFooter } = getAllHtml();
 
1867
  const css = getFullCSS();
1868
  const js = getFullJS();
1869
+ const configScript = `<script id="app-config" type="application/json">${JSON.stringify(config, null, 2)}<\/script>`;
1870
+ const html = `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Exported Page</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"><link rel="stylesheet" href="style.css"></head><body>${sidebar}<div class="main-content-pusher">${main}</div>${mobileFooter}${configScript}<script src="script.js"><\/script></body></html>`;
1871
 
1872
  zip.file("index.html", html);
1873
  zip.file("style.css", css);
 
1875
 
1876
  zip.generateAsync({type:"blob"}).then(content => { saveAs(content, "exported-page.zip"); showToast("ZIP file generated!"); });
1877
  }
1878
+
1879
+ /**
1880
+ * [MODIFIED] Handles importing a configuration file.
1881
+ */
1882
  function handleFileImport(event) {
1883
+ const file = event.target.files[0];
1884
+ if (!file) {
1885
+ return;
1886
+ }
1887
+
1888
+ const reader = new FileReader();
1889
+ reader.onload = function(e) {
1890
+ const fileContent = e.target.result;
1891
+ try {
1892
+ const parser = new DOMParser();
1893
+ const doc = parser.parseFromString(fileContent, 'text/html');
1894
+ const configScript = doc.getElementById('app-config');
1895
+
1896
+ if (!configScript) {
1897
+ showToast('Error: No configuration data found in this file.');
1898
+ return;
1899
+ }
1900
+
1901
+ const importedConfig = JSON.parse(configScript.textContent);
1902
+
1903
+ // Basic validation to ensure it's a valid config file
1904
+ if (!importedConfig || typeof importedConfig !== 'object' || !importedConfig.componentOrder || !importedConfig.globalSettings) {
1905
+ showToast('Error: Invalid or corrupted configuration file.');
1906
+ return;
1907
+ }
1908
+
1909
+ // SUCCESS: Update the main config object
1910
+ // Clear the existing config properties
1911
+ Object.keys(config).forEach(key => delete config[key]);
1912
+ // Assign the new properties from the imported config
1913
+ Object.assign(config, importedConfig);
1914
+
1915
+ showToast('Configuration imported successfully!');
1916
+
1917
+ // Re-initialize the entire UI to reflect the newly loaded config
1918
+ init();
1919
+
1920
+ } catch (error) {
1921
+ console.error("Import failed:", error);
1922
+ showToast(`Import failed: ${error.message}`);
1923
+ } finally {
1924
+ // Reset file input to allow importing the same file again if needed
1925
+ event.target.value = null;
1926
+ }
1927
+ };
1928
+ reader.readAsText(file);
1929
  }
1930
+
1931
  function handleGetCodeClick(e) {
1932
  const button = e.target.closest('.get-component-code-btn');
1933
  if (!button) return;
 
2017
  ui.mobileFooter.cta.text.value = config.mobileFooter.cta.text;
2018
  ui.mobileFooter.support.toggle.checked = config.mobileFooter.support.enabled;
2019
 
2020
+ // This is the first time running, so attach all event listeners.
2021
+ // On import, this function is called again, but the listeners are already attached.
2022
+ // Re-attaching them is harmless in this setup.
2023
+ if (!document.body.classList.contains('initialized')) {
2024
+ setupEventListeners();
2025
+ document.body.classList.add('initialized');
2026
+ }
2027
 
2028
  // Initial renders for dynamic controls
2029
  toggleLmsBrandControls();
 
2043
 
2044
  renderLayoutControls();
2045
  renderAll();
2046
+
2047
  if(!document.querySelector('.control-nav-button.active')){
2048
  ui.controls.nav.querySelector('.control-nav-button').click();
2049
  }