PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.8
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.8
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
← All changes | assets/src/js/frontend/course-builder.js +32 -0 4.3.74.4.8 View file →
@@ -67,8 +67,9 @@
67 67 getFormState();
68 68
69 69 // Initialize sidebar toggle
70 70 initSidebarToggle();
71 + initSidebarSubMenus();
71 72 initHeaderMoreActions();
72 73 } catch ( e ) {
73 74 console.error( 'Error initializing builder components:', e );
74 75 }
@@ -107,8 +108,39 @@
107 108 }
108 109
109 110 // Save state
110 111 localStorage.setItem( storageKey, willCollapse ? 'true' : 'false' );
112 + } );
113 +};
114 +
115 +/**
116 + * Initialize nested sidebar submenu toggles.
117 + */
118 +const initSidebarSubMenus = () => {
119 + const sidebar = document.getElementById( 'lp-course-builder-sidebar' );
120 +
121 + if ( ! sidebar || sidebar.dataset.subMenusInitialized === 'true' ) {
122 + return;
123 + }
124 +
125 + sidebar.dataset.subMenusInitialized = 'true';
126 +
127 + sidebar.addEventListener( 'click', ( e ) => {
128 + const toggleBtn = e.target.closest( '.lp-cb-sidebar__sub-menu-toggle' );
129 +
130 + if ( ! toggleBtn || ! sidebar.contains( toggleBtn ) ) {
131 + return;
132 + }
133 +
134 + const item = toggleBtn.closest( '.lp-cb-sidebar__item.has-sub-menu' );
135 + if ( ! item ) {
136 + return;
137 + }
138 +
139 + e.preventDefault();
140 +
141 + const isExpanded = item.classList.toggle( 'is-expanded' );
142 + toggleBtn.setAttribute( 'aria-expanded', isExpanded ? 'true' : 'false' );
111 143 } );
112 144 };
113 145
114 146 /**