A MoonBit port of CodeMirror 5, targeting the JavaScript backend
| Page | What runs | Result |
|---|---|---|
| test/index.html | MoonBit core + upstream JS modes/addons | 1481 / 1485 |
| test/native.html | MoonBit core + native MoonBit modes and addons | 1481 / 1485 |
| test/baseline.html | upstream CodeMirror itself (from src/) | 1481 / 1485 |
| Package | Contents |
|---|---|
| js/ | JavaScript FFI: values, regular expressions, DOM bindings |
| mode/ | Mode API: StringStream, ModeState trait, Mode, registry |
| core/ | The editor (model, display, input, edit) |
| modes/<name>/ | Native language modes |
| addon/<group>/ | Native addons |
| jsapi/ | JS-compatible CodeMirror API (api.js glue, generated into api_js.mbt by gen.py) |
| bundle/ | Entry point producing a codemirror.js replacement |
| demo/ | Demo page using the MoonBit API directly |
| css/ | codemirror.css and themes |
| test/ | Pages running the upstream test suite |
moon add bobzhang/codemirrormoon build --target jslet cm = @core.Editor::create(
parent_node,
config={ "value": "let x = 1", "mode": "javascript", "lineNumbers": true },
)
cm.on("change", _ => println(cm.get_value()))
cm.replace_range("// hi\n", @core.Pos::new(0, 0))