Browser code editor that aims to be kept as simple as possible.
- Short description
- Simple to get around
- Has a Tkinter-styled
config
API
- More event-based than property-based
- Doesn't handle automatic indentation
tc = new tinycoder(document.getElementById("tc"))
tc.config("syntaxHighlight", false)
console.log(tc.config("syntaxHighlight")) // Output: false
tc = new tinycoder(document.getElementById("tc"))
tc.events.update(function(e) {
console.log("Code is now updated!", e)
})
tc.updateCode("let it = \"go\"") // Output: Code is now updated! {code: "let it = \"go\""}
// On user edit, the "update" event will not be fired.
// Use "edit" instead.
For your ease, the documentation is given right here where are you watching this right now.
Name | Sample object | Fired on |
---|---|---|
update |
{"code": "let it = \"go\";"} |
Code updated programmatically via updateCode()
|
edit |
{"code": "let it = \"go\";", "code": false} |
Code edited programmatically via updateCode() and by user |
focus |
{"code": "let it = \"go\";"} |
focus -like event |
unfocus |
{"code": "let it = \"go\";"} |
blur -like event |
any |
Any from above | After every event |
Name | Sample value | Description |
---|---|---|
syntaxHighlight |
true |
Enables/disables syntax highlighting |
lineNumbers |
true |
Enables/disables line numbers |
fontStr |
"normal 12px \"Cascadia Mono\"" |
More information |