subscriptions : Model -> Sub Action
subscriptions model =
let
modalKeyUp m n = case n of
13 -> Modal m Accept
27 -> Modal m Close
_ -> Modal m NoModalAction
modalSub = case model.showModal of
NoModal -> Sub.none
m -> Keyboard.ups (modalKeyUp m)
in
modalSub
Context: I am trying to develop a textarea editor (like the one in this page that allows you to insert links and images via modal window).
Problem: If i click Enter when one of the inputs inside any of the modal windows is focused, the formulary will submit. I would know how to solve it if this happened to be an onClick event handler (using onWithOptions). But i do not know how to solve it when using subscriptions.
preventDefault- RamiroPastor