Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mint-lang/mint-codemirror
A Mint package that provides a CodeMirror component
https://github.com/mint-lang/mint-codemirror
codemirror mint-lang
Last synced: 3 months ago
JSON representation
A Mint package that provides a CodeMirror component
- Host: GitHub
- URL: https://github.com/mint-lang/mint-codemirror
- Owner: mint-lang
- License: mit
- Created: 2018-07-18T03:56:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T09:53:12.000Z (10 months ago)
- Last Synced: 2024-10-30T00:00:07.844Z (3 months ago)
- Topics: codemirror, mint-lang
- Language: Mint
- Homepage:
- Size: 87.9 KB
- Stars: 10
- Watchers: 5
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mint - Code Mirror
README
# mint-codemirror
This package provides a component for the [CodeMirror](https://codemirror.net) code editor to be used in Mint projects.
## Installation
To use the component just add this to the `dependencies` field of the projects
`mint.json` file.```json
"mint-codemirror": {
"repository": "https://github.com/mint-lang/mint-codemirror",
"constraint": "10.0.0 <= v < 11.0.0"
}
```## Usage
To get the basic component without any modes and the default theme, just add the component to your render function:
```mint
component Main {
fun onChange (value : String) : Promise(Void) {
Debug.log(value)
next { }
}fun render : Html {
}
}
```## Properties
The following properties are available:
Name
Type
Description
javascripts
Array(String)
URLs for the JavaScript files that are needed for CodeMirror to work.
This can come from a CDN or from local files. This should contain the
base JavaScript and any other addons or modes that is required.
styles
Array(String)
URLs for the CSS files that are that are needed for CodeMirror to work.
This can come from a CDN or from local files. This should contain the
base CSS and any other files for themes.
onChange
Function(String, a)
This is called when the content changes.
loadingContent
Html
This is shown until the all the files have loaded and editor is ready.
lineNumbers
Bool
Whether or not to show the line numbers.
lineWrapping
Bool
Whether or not to wrap the lines.
value
Bool
When provided this value will be in the editor.
theme
String
The theme of the editor.
mode
String
The mode of the editor.
## Advanced Usage
This is an example for using the all of the properties:
```mint
component Main {
state value : String = "def print\n puts 'Hello World!'\nend"fun onChange (value : String) : Promise(Void) {
next { value: value }
}fun render : Html {
}
}
```## License
MIT