wire up a main.elm
parent
bf0d39c999
commit
772ae700c4
|
@ -0,0 +1,56 @@
|
|||
module Main exposing (main)
|
||||
|
||||
import Browser
|
||||
import Edit.Document as Document exposing (Document(..))
|
||||
import Html exposing (Html)
|
||||
|
||||
|
||||
type alias Flags =
|
||||
()
|
||||
|
||||
|
||||
type Attr
|
||||
= Bold
|
||||
| Italic
|
||||
|
||||
|
||||
type alias Model =
|
||||
{ doc : Document Attr }
|
||||
|
||||
|
||||
type Msg
|
||||
= TODO
|
||||
|
||||
|
||||
init : Flags -> ( Model, Cmd Msg )
|
||||
init _ =
|
||||
( { doc =
|
||||
Document
|
||||
[ Document.Text "Hey" [ Bold ]
|
||||
, Document.Text " " []
|
||||
, Document.Text "there" [ Italic ]
|
||||
, Document.Text "!" []
|
||||
]
|
||||
}
|
||||
, Cmd.none
|
||||
)
|
||||
|
||||
|
||||
update : Msg -> Model -> ( Model, Cmd Msg )
|
||||
update msg model =
|
||||
( model, Cmd.none )
|
||||
|
||||
|
||||
view : Model -> Html msg
|
||||
view model =
|
||||
Html.text <| Debug.toString model
|
||||
|
||||
|
||||
main : Program Flags Model Msg
|
||||
main =
|
||||
Browser.element
|
||||
{ init = init
|
||||
, update = update
|
||||
, view = view
|
||||
, subscriptions = \_ -> Sub.none
|
||||
}
|
|
@ -1 +1,6 @@
|
|||
require("./elm-edit-element.js");
|
||||
require("./elm-edit-element.js"); // custom element
|
||||
const { Elm } = require("./Main.elm");
|
||||
|
||||
Elm.Main.init({
|
||||
node: document.getElementById("app")
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue