From 12a8b6bb63ab52cd4828f16d26d94079fa576436 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Tue, 18 Feb 2025 00:33:43 -0500 Subject: Add throwshade --- src/Utils.purs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Utils.purs') diff --git a/src/Utils.purs b/src/Utils.purs index e4fd125..7be7be8 100644 --- a/src/Utils.purs +++ b/src/Utils.purs @@ -26,6 +26,7 @@ import Web.Event.EventTarget as Ev.Tar import Web.HTML as HTML import Web.HTML.HTMLDocument as HTML.Doc import Web.HTML.HTMLInputElement as HTML.Input +import Web.HTML.HTMLTextAreaElement as HTML.TextArea import Web.HTML.Window as HTML.Win maybeToArray :: forall a. Maybe a -> Array a @@ -91,6 +92,11 @@ appendText parent s = do setText :: forall m. MonadEffect m => DOM.Element -> String -> m Unit setText e s = liftEffect $ DOM.Node.setTextContent s $ DOM.El.toNode e +getTextArea :: forall m. MonadEffect m => DOM.Element -> m String +getTextArea e = case HTML.TextArea.fromElement e of + Just inp -> liftEffect $ HTML.TextArea.value inp + Nothing -> liftEffect $ throw "element is not a text area" + getValue :: forall m. MonadEffect m => DOM.Element -> m String getValue e = case HTML.Input.fromElement e of Just inp -> liftEffect $ HTML.Input.value inp -- cgit v1.2.3