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.Method
Contents
Description
Synopsis
- setTextSelection :: MisoString -> SetTextSelection -> action -> (MisoString -> action) -> Effect parent model action
- getTextBoundingRect :: MisoString -> GetTextBoundingRect -> (JSVal -> action) -> (MisoString -> action) -> Effect parent model action
- getSelectedText :: MisoString -> (MisoString -> action) -> (MisoString -> action) -> Effect parent model action
- data SetTextSelection = SetTextSelection {}
- defaultGetTextBoundingRect :: GetTextBoundingRect
Methods
setTextSelection :: MisoString -> SetTextSelection -> action -> (MisoString -> action) -> Effect parent model action Source #
https://lynxjs.org/api/elements/built-in/text.html#setTextSelection
This method sets the selected text based on start and end positions and controls the visibility of selection handles. The response res contains:
data Action = SetText | TextSet | SetTextError MisoString update :: Action -> Effect model Action update SetText = setTextSelection "someImageId" SetText SetTextError update TextSet = io_ (consoleLog "text was set") update (SetTextError e) = io_ (consoleLog e)
getTextBoundingRect :: MisoString -> GetTextBoundingRect -> (JSVal -> action) -> (MisoString -> action) -> Effect parent model action Source #
https://lynxjs.org/api/elements/built-in/text.html#gettextboundingrect
This method retrieves the bounding box of a specific range of text.
data Action = RectReceived Rect | GetRect | GotError MisoString update :: Action -> Effect model Action update GetRect = getTextBoundingRect "#box" defaultGetTextBoundingRect RectReceived GotError update (RectReceived rect) = io_ $ consoleLog ("got rect") update (GotError errMsg) = io_ (consoleLog errMsg)
getSelectedText :: MisoString -> (MisoString -> action) -> (MisoString -> action) -> Effect parent model action Source #
https://lynxjs.org/api/elements/built-in/text.html#getselectedtext
This method retrieves the string content of the currently selected text.
data Action = TextReceived MisoString | GetText | GotError MisoString update :: Action -> Effect model Action update GetText = getSelectedText "#box" TextReceived GotError update (TextReceived txt) = io_ (consoleLog ("got text: " <> txt)) update (GotError errMsg) = io_ (consoleLog errMsg)
Types
data SetTextSelection Source #
Constructors
SetTextSelection | |
Fields
|
Instances
ToJSVal SetTextSelection Source # | |
Defined in Miso.Lynx.Element.Text.Method Methods toJSVal :: SetTextSelection -> JSM JSVal Source # toJSValListOf :: [SetTextSelection] -> JSM JSVal Source # |
Smart constructors
defaultGetTextBoundingRect :: GetTextBoundingRect Source #