fix: resolve initialization bugs breaking level indicator and expected preview
- Fix renderLesson to handle null inputEl (CodeMirror replaces textarea) - Fix renderExpectedPreview to use 'solution' property instead of 'solutionCode' - These fixes restore level indicator, expected preview, and auto-run functionality
This commit is contained in:
@@ -133,10 +133,10 @@ export function renderLesson(titleEl, descriptionEl, taskEl, previewEl, prefixEl
|
|||||||
// Set task instructions
|
// Set task instructions
|
||||||
taskEl.innerHTML = lesson.task || "";
|
taskEl.innerHTML = lesson.task || "";
|
||||||
|
|
||||||
// Set code editor contents
|
// Set code editor contents (if inputEl is provided)
|
||||||
// prefixEl.textContent = lesson.codePrefix || "";
|
if (inputEl) {
|
||||||
inputEl.value = lesson.initialCode || "";
|
inputEl.value = lesson.initialCode || "";
|
||||||
// suffixEl.textContent = lesson.codeSuffix || "";
|
}
|
||||||
|
|
||||||
// Clear any existing feedback
|
// Clear any existing feedback
|
||||||
clearFeedback();
|
clearFeedback();
|
||||||
|
|||||||
@@ -239,7 +239,8 @@ export class LessonEngine {
|
|||||||
renderExpectedPreview() {
|
renderExpectedPreview() {
|
||||||
if (!this.currentLesson) return;
|
if (!this.currentLesson) return;
|
||||||
|
|
||||||
const solutionCode = this.currentLesson.solutionCode;
|
// Use 'solution' property from lesson JSON (not 'solutionCode')
|
||||||
|
const solutionCode = this.currentLesson.solution;
|
||||||
if (!solutionCode) {
|
if (!solutionCode) {
|
||||||
// No solution code provided, hide the expected pane or show placeholder
|
// No solution code provided, hide the expected pane or show placeholder
|
||||||
const expectedContainer = document.getElementById("preview-expected");
|
const expectedContainer = document.getElementById("preview-expected");
|
||||||
|
|||||||
Reference in New Issue
Block a user