miso-lynx
Copyright(C) 2016-2025 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <code@dmj.io>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Lynx.Element.Text.Event

Description

 
Synopsis

Events

onLayout :: (LayoutEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/text.html#layout

The layout event returns the result information after text layout, including the number of lines of the current text, and the start and end positions of the text in each line relative to the entire text.

data Action = HandleLayout LayoutEvent

view :: Model -> View Action
view model = text_ [ onLayout HandleLayout ] [ text "hi" ]

update :: Action -> Effect Model Action
update (HandleLayout LayoutEvent {..}) = io_ (consoleLog "layout event received")

onSelectionChange :: (SelectionChangeEvent -> action) -> Attribute action Source #

https://lynxjs.org/api/elements/built-in/text.html#selectionchange

This event is triggered whenever the selected text range changes.

data Action = HandleSelectionChange SelectionChangeEvent

view :: Model -> View Action
view model = text_ [ onSelectionChange HandleSelectionChange ] [ text "hi" ]

update :: Action -> Effect Model Action
update (HandleSelectionChange SelectionChangeEvent {..}) =
  io_ (consoleLog "selection change event received")

Types

data Size Source #

Constructors

Size 

Instances

Instances details
Show Size Source # 
Instance details

Defined in Miso.Lynx.Element.Text.Event

Methods

showsPrec :: Int -> Size -> ShowS #

show :: Size -> String #

showList :: [Size] -> ShowS #

Eq Size Source # 
Instance details

Defined in Miso.Lynx.Element.Text.Event

Methods

(==) :: Size -> Size -> Bool #

(/=) :: Size -> Size -> Bool #

Decoders

Event Map