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 LineInfo Source #

Instances

Instances details
Show LineInfo Source # 
Instance details

Defined in Miso.Lynx.Element.Text.Event

Eq LineInfo Source # 
Instance details

Defined in Miso.Lynx.Element.Text.Event

FromJSON LineInfo Source # 
Instance details

Defined in Miso.Lynx.Element.Text.Event

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 #

data Direction Source #

Constructors

Forward 
Backward 

Instances

Instances details
Show Direction Source # 
Instance details

Defined in Miso.Lynx.Element.Text.Event

Eq Direction Source # 
Instance details

Defined in Miso.Lynx.Element.Text.Event

FromJSON Direction Source # 
Instance details

Defined in Miso.Lynx.Element.Text.Event

Decoders

Event Map