Copyright | (C) 2016-2025 David M. Johnson |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <code@dmj.io> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Miso.Lynx.Element.Text.Event
Description
Synopsis
- onLayout :: (LayoutEvent -> action) -> Attribute action
- onSelectionChange :: (SelectionChangeEvent -> action) -> Attribute action
- data LayoutEvent = LayoutEvent {}
- data LineInfo = LineInfo {}
- data Size = Size {
- sizeWidth :: Double
- sizeHeight :: Double
- data SelectionChangeEvent = SelectionChangeEvent {}
- data Direction
- layoutDecoder :: Decoder LayoutEvent
- selectionChangeDecoder :: Decoder SelectionChangeEvent
- textEvents :: Events
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 LayoutEvent Source #
Constructors
LayoutEvent | |
Fields
|
Instances
Show LayoutEvent Source # | |
Defined in Miso.Lynx.Element.Text.Event Methods showsPrec :: Int -> LayoutEvent -> ShowS # show :: LayoutEvent -> String # showList :: [LayoutEvent] -> ShowS # | |
Eq LayoutEvent Source # | |
Defined in Miso.Lynx.Element.Text.Event |
Constructors
LineInfo | |
Fields |
Constructors
Size | |
Fields
|
data SelectionChangeEvent Source #
Instances
Show SelectionChangeEvent Source # | |
Defined in Miso.Lynx.Element.Text.Event Methods showsPrec :: Int -> SelectionChangeEvent -> ShowS # show :: SelectionChangeEvent -> String # showList :: [SelectionChangeEvent] -> ShowS # | |
Eq SelectionChangeEvent Source # | |
Defined in Miso.Lynx.Element.Text.Event Methods (==) :: SelectionChangeEvent -> SelectionChangeEvent -> Bool # (/=) :: SelectionChangeEvent -> SelectionChangeEvent -> Bool # |
Decoders
Event Map
textEvents :: Events Source #