CodeEditor
AppEngine-agnostic code editor primitive. M1 ships a lightweight CodeMirror-style fallback engine (textarea + line-number gutter + active-line + theme + readonly + placeholder) so the public API is stable today. Future milestones: Monaco (VSCode) lazy engine, find/replace, multi-cursor, diagnostics (markers), custom autocomplete + hover, minimap, code folding, vim/emacs keymap. Pixel-identical React sibling at modules/ui/CodeEditor/index.tsx. Used by RulesetEditor M3 + RichTextEditor code-block insert (planned).
Read-only JavaScript snippet with line numbers.
<%- include('modules/ui/CodeEditor', {
id: 'example',
label: 'example.js',
language: 'js',
theme: 'light',
value: source,
readonly: true,
showLineNumbers: true
}) %>
Editable markdown. The hidden form input is synced to the value.
<%- include('modules/ui/CodeEditor', {
id: 'readme',
name: 'readme',
label: 'README.md',
language: 'markdown',
theme: 'dark',
value: src,
placeholder: 'Start typing markdown…'
}) %>
<%
// ─── CodeEditor (EJS) ──────────────────────────────────────────────────────
//
// Pixel-identical sibling of
// /home/kuray/01_NextJS_Components/modules/ui/CodeEditor/index.tsx.
//
// M1 implements: engine flag (default codemirror — falls back to a textarea
// engine when CodeMirror 6 is not present), language data attribute, light/
// dark/high-contrast theme, readonly, placeholder, line-number gutter.
//
// Locals:
// id — required, used as