[{"name":"MiniRte","comment":" Don't forget to hook [subscriptions](#subscriptions) and [update](#update) into your app's own `subscriptions` and `update` function. Otherwise the RTE won't do anything.\n\n**Note**: When the RTE is active (the [textarea](#textarea) object is part of your `view`), it keeps taking away the focus from every other element. Use [freeze](#freeze) to stop this.\n\n# Init and update\n\n@docs Rte, init, subscriptions, update\n\n# View\n\n@docs textarea, showContent, showContentCustom, showEncodedContent, showEncodedContentCustom\n\n# View Styled\n\nSame as the previous but with `Html.Styled`.\n\n@docs textareaStyled, showContentStyled, showContentCustomStyled, showEncodedContentStyled, showEncodedContentCustomStyled\n\n# Configure\n\n@docs makePastedLinksClickable, setCharacterLimit, setFontSizeUnit, setHighlighter, setIndentUnit, setSelectionStyle, turnPastedImageLinksIntoImgElements    \n\n# Control\n\nYou can build a rich text editor toolbar from these (see the [example](https://github.com/dkodaj/rte/blob/master/example/src/Main.elm) in the repo).\n\n@docs addContent, addCustomHtml, addImageWithSrc, addLink, addText, copy, cut, decreaseIndent, freeze, increaseIndent, paste, replaceContent\n@docs replaceContentString, setFontSize, setSelection, setTextAlignment, toggleBold, toggleClass, toggleFontFamily, toggleHeading\n@docs toggleItalic, toggleNodeType, toggleStrikethrough, toggleUnderline, undo, unlink, unfreeze  \n\n# Info\n\n@docs content, fontFamily, fontSize, freezed, textContent\n\n# Conversions\n\n@docs textToContent, contentToText, decodeContentString, decodeContentGZip, encodeContentString, encodeContentGZip\n\n# Hardwired key combos\n\n- `Ctrl-0`: en dash (–)\n- `Ctrl-1`: em dash (—)\n- `Ctrl-A`: select all\n- `Ctrl-C`: copy (to use copied content outside the RTE, you need to add a port; see the [example](https://github.com/dkodaj/rte/blob/master/example/html/index.html))\n- `Ctrl-X`: cut\n- `Ctrl-Z`: undo\n- `Ctrl-V`: paste (to paste stuff that was copied to the clipboard outside the RTE, you need to add a port; see the [example](https://github.com/dkodaj/rte/blob/master/example/html/index.html))\n\n","unions":[{"name":"Rte","comment":" The rich text editor. [Under the hood](https://github.com/dkodaj/rte/blob/master/src/MiniRte/Core.elm?plain=1#L71), it is a record type that tracks cursor position, selection, formatting etc.\n","args":[],"cases":[]}],"aliases":[],"values":[{"name":"addContent","comment":" Add content at current cursor position.\n","type":"MiniRte.Types.Content -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"addCustomHtml","comment":" Embed a custom html node within text.\n","type":"MiniRte.Types.EmbeddedHtmlRecord -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"addImageWithSrc","comment":" An `img` node with the specified `src`.\n","type":"String.String -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"addLink","comment":" Turn the current selection into a link.\n","type":"String.String -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"addText","comment":" Insert text at current cursor position.\n","type":"String.String -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"content","comment":" The edited content of the RTE.\n","type":"MiniRte.Rte -> MiniRte.Types.Content"},{"name":"contentToText","comment":"","type":"MiniRte.Types.Content -> String.String"},{"name":"copy","comment":" Copy current selection. Results in a `ToBrowserClipboard` Msg which must be captured in `update`. See the [example](https://github.com/dkodaj/rte/blob/master/example/src/Main.elm).\n","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"cut","comment":"","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"decodeContentGZip","comment":" Convert gzipped content json into edited content.\n","type":"Bytes.Bytes -> Result.Result String.String MiniRte.Types.Content"},{"name":"decodeContentString","comment":" Convert content json string into edited content.\n","type":"String.String -> Result.Result String.String MiniRte.Types.Content"},{"name":"decreaseIndent","comment":"","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"encodeContentGZip","comment":" Encode the edited content in a gzipped json string.\n","type":"MiniRte.Rte -> Bytes.Bytes"},{"name":"encodeContentString","comment":" Encode the edited content in a json string.\n","type":"MiniRte.Rte -> String.String"},{"name":"fontFamily","comment":" The font-family (set with [toggleFontFamily](#toggleFontFamily)) at the cursor position.\n","type":"MiniRte.Rte -> List.List String.String"},{"name":"fontSize","comment":" The font-size (set with [setFontSize](#setFontSize)) at the cursor position.\n","type":"MiniRte.Rte -> Maybe.Maybe Basics.Float"},{"name":"freeze","comment":" Hides cursor and stops listening to mouse and keyboard events.\n","type":"MiniRte.Rte -> MiniRte.Rte"},{"name":"freezed","comment":"","type":"MiniRte.Rte -> Basics.Bool"},{"name":"increaseIndent","comment":"","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"init","comment":" The string you pass in is an `id`, which must be unique.\n","type":"String.String -> MiniRte.Rte"},{"name":"makePastedLinksClickable","comment":" Control whether pasting something that begins with with `http(s)://` becomes a clickable link. Default is `False`.\n","type":"Basics.Bool -> MiniRte.Rte -> MiniRte.Rte"},{"name":"paste","comment":"","type":"String.String -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"replaceContent","comment":" Clears the editor and loads new content.\n","type":"MiniRte.Types.Content -> MiniRte.Rte -> MiniRte.Rte"},{"name":"replaceContentString","comment":" Same with plain text.\n","type":"String.String -> MiniRte.Rte -> MiniRte.Rte"},{"name":"setCharacterLimit","comment":" Prevent typing more than a certain number of characters. There is no default limit, but the RTE becomes increasingly slow for longer texts (>10-12K characters).\n","type":"Basics.Int -> MiniRte.Rte -> MiniRte.Rte"},{"name":"setFontSize","comment":" Controls the font size within the selected text / at the current cursor position.\n","type":"Basics.Float -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"setFontSizeUnit","comment":" Defaults to `px`.\n","type":"String.String -> MiniRte.Rte -> MiniRte.Rte"},{"name":"setHighlighter","comment":" See [MiniRte.Types](/packages/dkodaj/rte/latest/MiniRte-Types) on highlighters.\n","type":"Maybe.Maybe (MiniRte.Types.Content -> MiniRte.Types.Content) -> MiniRte.Rte -> MiniRte.Rte"},{"name":"setIndentUnit","comment":" Defaults to `(50,\"px\")`. Matters when you use [increaseIndent](#increaseIndent) or [decreaseIndent](#decreaseIndent). \n","type":"( Basics.Float, String.String ) -> MiniRte.Rte -> MiniRte.Rte"},{"name":"setSelection","comment":"","type":"( Basics.Int, Basics.Int ) -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"setSelectionStyle","comment":" Controls how selected text looks. Defaults to `[(\"background\",\"hsl(217,71%,53%)\"), (\"color\",\"hsl(0,0%,100%)\")]`.\n","type":"List.List ( String.String, String.String ) -> MiniRte.Rte -> MiniRte.Rte"},{"name":"setTextAlignment","comment":"","type":"MiniRte.Types.TextAlignType -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"showContent","comment":" Display, in an uneditable div, the content generated by the RTE.\n","type":"MiniRte.Types.Content -> List.List (Html.Attribute MiniRte.Types.Msg) -> Html.Html MiniRte.Types.Msg"},{"name":"showContentCustom","comment":" Same with some parameters.\n","type":"{ fontSizeUnit : Maybe.Maybe String.String, indentUnit : Maybe.Maybe ( Basics.Float, String.String ), highlighter : Maybe.Maybe (MiniRte.Types.Content -> MiniRte.Types.Content) } -> MiniRte.Types.Content -> List.List (Html.Attribute MiniRte.Types.Msg) -> Html.Html MiniRte.Types.Msg"},{"name":"showContentCustomStyled","comment":"","type":"{ fontSizeUnit : Maybe.Maybe String.String, indentUnit : Maybe.Maybe ( Basics.Float, String.String ), highlighter : Maybe.Maybe (MiniRte.Types.Content -> MiniRte.Types.Content) } -> MiniRte.Types.Content -> List.List (Html.Styled.Attribute MiniRte.Types.Msg) -> Html.Styled.Html MiniRte.Types.Msg"},{"name":"showContentStyled","comment":"","type":"MiniRte.Types.Content -> List.List (Html.Styled.Attribute MiniRte.Types.Msg) -> Html.Styled.Html MiniRte.Types.Msg"},{"name":"showEncodedContent","comment":" Same but using a json generated with [encodeContentString](#encodeContentString).\n","type":"List.List (Html.Attribute MiniRte.Types.Msg) -> String.String -> Html.Html MiniRte.Types.Msg"},{"name":"showEncodedContentCustom","comment":" Same with some parameters.\n","type":"{ fontSizeUnit : Maybe.Maybe String.String, indentUnit : Maybe.Maybe ( Basics.Float, String.String ), highlighter : Maybe.Maybe (MiniRte.Types.Content -> MiniRte.Types.Content) } -> List.List (Html.Attribute MiniRte.Types.Msg) -> String.String -> Html.Html MiniRte.Types.Msg"},{"name":"showEncodedContentCustomStyled","comment":"","type":"{ fontSizeUnit : Maybe.Maybe String.String, indentUnit : Maybe.Maybe ( Basics.Float, String.String ), highlighter : Maybe.Maybe (MiniRte.Types.Content -> MiniRte.Types.Content) } -> List.List (Html.Styled.Attribute MiniRte.Types.Msg) -> String.String -> Html.Styled.Html MiniRte.Types.Msg"},{"name":"showEncodedContentStyled","comment":"","type":"List.List (Html.Styled.Attribute MiniRte.Types.Msg) -> String.String -> Html.Styled.Html MiniRte.Types.Msg"},{"name":"subscriptions","comment":" Doesn't do anything when the RTE is [freeze](#freeze)d.\n","type":"MiniRte.Rte -> Platform.Sub.Sub MiniRte.Types.Msg"},{"name":"textContent","comment":" The plain text content of the RTE.\n","type":"MiniRte.Rte -> String.String"},{"name":"textToContent","comment":"","type":"String.String -> MiniRte.Types.Content"},{"name":"textarea","comment":" Show the RTE.\n","type":"MiniRte.Rte -> List.List (Html.Attribute MiniRte.Types.Msg) -> Html.Html MiniRte.Types.Msg"},{"name":"textareaStyled","comment":"","type":"MiniRte.Rte -> List.List (Html.Styled.Attribute MiniRte.Types.Msg) -> Html.Styled.Html MiniRte.Types.Msg"},{"name":"toggleBold","comment":"","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"toggleClass","comment":"","type":"String.String -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"toggleFontFamily","comment":"","type":"List.List String.String -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"toggleHeading","comment":" Turns the current paragraph into an `h1` element.\n","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"toggleItalic","comment":"","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"toggleNodeType","comment":"","type":"String.String -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"toggleStrikethrough","comment":"","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"toggleUnderline","comment":"","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"turnPastedImageLinksIntoImgElements","comment":"  When you paste an image link `x`, it becomes an img element with `src=x`.\nSomething qualifies as an image link iff it starts with `data:image/` or it ends with `.jpeg`, `.jpg`, `.gif`, `.png`, `.apng`, `.svg`, `.bmp`, or `.ico`.\nDefaults to `False`.\n","type":"Basics.Bool -> MiniRte.Rte -> MiniRte.Rte"},{"name":"undo","comment":"","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"unfreeze","comment":" Show the cursor and activate mouse/keyboard listeners.\n","type":"MiniRte.Rte -> MiniRte.Rte"},{"name":"unlink","comment":" Remove the `href` at the current cursor position.\n","type":"MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"},{"name":"update","comment":"","type":"MiniRte.Types.Msg -> MiniRte.Rte -> ( MiniRte.Rte, Platform.Cmd.Cmd MiniRte.Types.Msg )"}],"binops":[]},{"name":"MiniRte.Types","comment":"\n\n@docs Msg, TextAlignType\n\n\n# Writing highlighters\n\nA highlighter is a `Content -> Content` function that you can inject into the model using `setHighlighter`.\nThe function should modify the `highlightClasses`, `highlightIndent`, or `highlightStyling` fields of the elements.\nEach string `x` in `highlightClasses` turns into `Html.(Styled.)Attribute.class x`.\nEach `(x,y)` in `highlightStyling` turns into `Html.(Styled.)Attribute.style x y`.\nAttributes of `LineBreak`s apply to the paragraph (the previous non-linebreak elements) as a whole.\n\n@docs Content, Element, CharacterRecord, EmbeddedHtmlRecord, emptyEmbeddedHtml, LineBreakRecord, Child, FontStyle\n\n","unions":[{"name":"Child","comment":" ","args":[],"cases":[["Child",["MiniRte.Types.EmbeddedHtmlRecord"]]]},{"name":"Element","comment":" ","args":[],"cases":[["Character",["MiniRte.Types.CharacterRecord"]],["EmbeddedHtml",["MiniRte.Types.EmbeddedHtmlRecord"]],["LineBreak",["MiniRte.Types.LineBreakRecord"]]]},{"name":"Msg","comment":" `CharacterLimitReached` allows you to get notified if too much text is entered.\n\n`FromBrowserClipboard` and `ToBrowserClipboard` can be used to handle copy/pasting text from the RTE to other apps and vice versa. See the [example](https://github.com/dkodaj/rte/blob/master/example/src/Main.elm).\n\n`InternalMsg` is not part of the API.\n","args":[],"cases":[["CharacterLimitReached",["Basics.Int"]],["FromBrowserClipboard",["String.String"]],["Internal",["MiniRte.TypesThatAreNotPublic.InternalMsg"]],["ToBrowserClipboard",["String.String"]]]},{"name":"TextAlignType","comment":" ","args":[],"cases":[["Center",[]],["Left",[]],["Right",[]]]}],"aliases":[{"name":"CharacterRecord","comment":" ","args":[],"type":"{ char : Char.Char, fontStyle : MiniRte.Types.FontStyle, highlightClasses : List.List String.String, highlightStyling : List.List ( String.String, String.String ), link : Maybe.Maybe String.String }"},{"name":"Content","comment":" ","args":[],"type":"Array.Array MiniRte.Types.Element"},{"name":"EmbeddedHtmlRecord","comment":"  You can embed any html node using this type. The RTE will only be able to delete or copy/paste these elements.\n","args":[],"type":"{ attributes : List.List ( String.String, String.String ), classes : List.List String.String, children : List.List MiniRte.Types.Child, highlightClasses : List.List String.String, highlightStyling : List.List ( String.String, String.String ), nodeType : Maybe.Maybe String.String, styling : List.List ( String.String, String.String ), text : Maybe.Maybe String.String }"},{"name":"FontStyle","comment":" ","args":[],"type":"{ classes : List.List String.String, fontFamily : List.List String.String, fontSize : Maybe.Maybe Basics.Float, styling : List.List ( String.String, String.String ) }"},{"name":"LineBreakRecord","comment":" ","args":[],"type":"{ classes : List.List String.String, highlightClasses : List.List String.String, highlightIndent : Basics.Int, highlightStyling : List.List ( String.String, String.String ), id : String.String, indent : Basics.Int, nodeType : Maybe.Maybe String.String, styling : List.List ( String.String, String.String ), textAlign : MiniRte.Types.TextAlignType }"}],"values":[{"name":"emptyEmbeddedHtml","comment":" An empty div.\n","type":"MiniRte.Types.EmbeddedHtmlRecord"}],"binops":[]}]