billstclair / elm-custom-element / CustomElement.CodeEditor

The Elm interface to the code-editor custom element.

Inspired by Luke Westby's Elm Europe talk. The JavaScript custom element code is almost a verbatim copy.

This code won't do anything unless site/js/code-editor.js is loaded, and its CodeMirror files from site/lib.

Html Elements

codeEditor : List (Html.Attribute msg) -> List (Html msg) -> Html msg

Create a code editor Html element.

Attributes

editorValue : String -> Html.Attribute msg

This is how you set the contents of the code editor.

Events

onEditorChanged : (String -> msg) -> Html.Attribute msg

This is how you receive changes to the contents of the code editor.