Skip to content

feat(learning-ui): upgrade web code editor to CodeMirror 6 with Prettier formatting - #334

Draft
FaisalMisbah23 wants to merge 2 commits into
devweekends:mainfrom
FaisalMisbah23:feat/code-editor-formatter
Draft

FaisalMisbah23 wants to merge 2 commits into
devweekends:mainfrom
FaisalMisbah23:feat/code-editor-formatter

Conversation

@FaisalMisbah23

Copy link
Copy Markdown
Collaborator

Summary

  • Replace the plain <textarea> editor in web graded code exercises (CodeExerciseClient) and inline runnable JS blocks (RunnableJs) with a shared CodeMirror 6 editor (CodeMirrorEditor) supporting syntax highlighting, bracket matching/auto-closing, 2-space Tab/Shift+Tab indentation, active-line highlighting, and undo/redo history.
  • Add an on-demand Format button (Shift+Alt+F) powered by lazy-loaded prettier/standalone (formatCode) that preserves cursor position, supports Ctrl+Z undo, and displays concise single-line syntax errors when code cannot parse.
  • Add light/dark --cm-* syntax tokens to match Edorax's --code-* theme surfaces, plus unit tests for formatCode and canFormatLanguage.
  • Keep CodeExerciseClient's renderEditor prop intact so the desktop workspace editor is unaffected.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant