File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -653,8 +653,11 @@ function loadCurrentLesson() {
653653 renderDifficultyBadge ( elements . lessonTitleRow , lesson ) ;
654654
655655 // Set user code in CodeMirror (clear history to prevent undo/redo across lessons)
656+ // Pass codePrefix/codeSuffix as read-only zones for CSS mode
656657 if ( codeEditor ) {
657- codeEditor . setValueAndClearHistory ( engineState . userCode ) ;
658+ const prefix = lesson . codePrefix || "" ;
659+ const suffix = lesson . codeSuffix || "" ;
660+ codeEditor . setValueAndClearHistory ( engineState . userCode , prefix , suffix ) ;
658661 }
659662
660663 // Update Run button text based on completion status
@@ -869,7 +872,7 @@ function loadRandomTemplate() {
869872}
870873
871874function runCode ( ) {
872- const userCode = codeEditor ? codeEditor . getValue ( ) : "" ;
875+ const userCode = codeEditor ? codeEditor . getEditableValue ( ) : "" ;
873876 const engineState = lessonEngine . getCurrentState ( ) ;
874877 const isPlayground = engineState . lesson ?. mode === "playground" ;
875878
You can’t perform that action at this time.
0 commit comments