Try Install Learn Blog API Packages GitHub
Pages

CodeMirror

A component that integrates the CodeMirror editor.

Properties

javascripts
:
Array(String)
=
[@asset(../assets/codemirror.min.js)]

The JavaScript files of Codemirror to load, either locally or from a CDN.

lineNumbers
:
Bool
=
true

Whether or not to show the line numbers.

lineWrapping
:
Bool
=
false

Whether or not to wrap the lines.

loadingContent
:
Html
=
<></>

The content to display until the editor is loaded.

mode
:
String
=
""

The mode of the editor.

onChange
:
Function(String, Promise(Void))
=
Promise.never1

Handler for the change event.

readOnly
:
Bool
=
false

Whether or not the content is editable.

styles
:
Array(String)
=
[@asset(../assets/codemirror.min.css)]

The CSS files of Codemirror to load, either locally or from a CDN.

tabSize
:
Number
=
2

The number of spaces used for indentation.

theme
:
String
=
""

The theme of the editor.

value
:
String
=
""

When provided this value will be in the editor.

Functions

componentDidMount
:
Promise(Void)

Loads all assets when the components mounts.

After an update, update the underlying editor instance.

Initializes the editor for the given dom element.

render
:
Html

Renders the component.