Fix #27: Render universal emojis.
This commit is contained in:
parent
d47a5ad7cc
commit
9753efe7e8
@ -22,6 +22,7 @@
|
|||||||
"jinjor/elm-html-parser": "1.1.5 <= v < 2.0.0",
|
"jinjor/elm-html-parser": "1.1.5 <= v < 2.0.0",
|
||||||
"lukewestby/elm-http-builder": "5.1.0 <= v < 6.0.0",
|
"lukewestby/elm-http-builder": "5.1.0 <= v < 6.0.0",
|
||||||
"rluiten/elm-date-extra": "8.5.0 <= v < 9.0.0",
|
"rluiten/elm-date-extra": "8.5.0 <= v < 9.0.0",
|
||||||
|
"teepark/elmoji": "2.0.2 <= v < 3.0.0",
|
||||||
"thebritican/elm-autocomplete": "4.0.3 <= v < 5.0.0"
|
"thebritican/elm-autocomplete": "4.0.3 <= v < 5.0.0"
|
||||||
},
|
},
|
||||||
"elm-version": "0.18.0 <= v < 0.19.0"
|
"elm-version": "0.18.0 <= v < 0.19.0"
|
||||||
|
@ -810,3 +810,11 @@ input.form-control[type=file] {
|
|||||||
.modal-content {
|
.modal-content {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Emojis */
|
||||||
|
|
||||||
|
.elmoji-img {
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
margin-right: 1px;
|
||||||
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
module View.Formatter exposing (formatContent)
|
module View.Formatter exposing (formatContent)
|
||||||
|
|
||||||
|
import Elmoji
|
||||||
import Html exposing (..)
|
import Html exposing (..)
|
||||||
import Html.Attributes exposing (..)
|
import Html.Attributes exposing (..)
|
||||||
import HtmlParser
|
import HtmlParser
|
||||||
@ -32,11 +33,7 @@ toVirtualDom mentions nodes =
|
|||||||
|
|
||||||
createLinkNode : List ( String, String ) -> List HtmlParser.Node -> List Mention -> Html Msg
|
createLinkNode : List ( String, String ) -> List HtmlParser.Node -> List Mention -> Html Msg
|
||||||
createLinkNode attrs children mentions =
|
createLinkNode attrs children mentions =
|
||||||
let
|
case (getMentionForLink attrs mentions) of
|
||||||
maybeMention =
|
|
||||||
getMentionForLink attrs mentions
|
|
||||||
in
|
|
||||||
case maybeMention of
|
|
||||||
Just mention ->
|
Just mention ->
|
||||||
Html.node "a"
|
Html.node "a"
|
||||||
((List.map toAttribute attrs)
|
((List.map toAttribute attrs)
|
||||||
@ -55,8 +52,8 @@ createLinkNode attrs children mentions =
|
|||||||
getHrefLink : List ( String, String ) -> Maybe String
|
getHrefLink : List ( String, String ) -> Maybe String
|
||||||
getHrefLink attrs =
|
getHrefLink attrs =
|
||||||
attrs
|
attrs
|
||||||
|> List.filter (\( name, value ) -> (name == "href"))
|
|> List.filter (\( name, _ ) -> name == "href")
|
||||||
|> List.map (\( name, value ) -> value)
|
|> List.map (\( _, value ) -> value)
|
||||||
|> List.head
|
|> List.head
|
||||||
|
|
||||||
|
|
||||||
@ -82,7 +79,7 @@ toVirtualDomEach mentions node =
|
|||||||
Html.node name (List.map toAttribute attrs) (toVirtualDom mentions children)
|
Html.node name (List.map toAttribute attrs) (toVirtualDom mentions children)
|
||||||
|
|
||||||
HtmlParser.Text s ->
|
HtmlParser.Text s ->
|
||||||
text s
|
Elmoji.text_ s
|
||||||
|
|
||||||
HtmlParser.Comment _ ->
|
HtmlParser.Comment _ ->
|
||||||
text ""
|
text ""
|
||||||
|
Loading…
Reference in New Issue
Block a user