git.iko.soy/typeable/elm-ui
on master help sign in
Multiline fixes - add nbsp at the end of filler element to prevent newline being chomped. Wrap filler text for textarea so that it can be styled without affecting inheritance of font color
75974ccMatthew Griffith
src/Element/Input.elm+8−2
@@ -1002,7 +1002,13 @@ textHelper textInput attrs textOptions =
1002 ]
1002 ]
1003
1003
1004 else
1004 else
1005− [ Internal.unstyled (Html.text textOptions.text) ]
1005+ [ Internal.unstyled
1006+ (Html.span [ Html.Attributes.class classes.inputMultilineFiller ]
1007+ -- We append a non-breaking space to the end of the content so that newlines don't get chomped.
1008+ [ Html.text (textOptions.text ++ "\u{00A0}")
1009+ ]
1010+ )
1011+ ]
1006 )
1012 )
1007 )
1013 )
1008 ]
1014 ]
@@ -1323,7 +1329,7 @@ redistributeOver isMultiline stacked attr els =
1323 Internal.StyleClass _ (Internal.FontFamily _ _) ->
1329 Internal.StyleClass _ (Internal.FontFamily _ _) ->
1324 { els | fullParent = attr :: els.fullParent }
1330 { els | fullParent = attr :: els.fullParent }
1325
1331
1326− Internal.StyleClass _ _ ->
1332+ Internal.StyleClass flag cls ->
1327 { els | parent = attr :: els.parent }
1333 { els | parent = attr :: els.parent }
1328
1334
1329 Internal.NoAttribute ->
1335 Internal.NoAttribute ->
src/Internal/Model.elm+7−25
@@ -2166,8 +2166,8 @@ rootStyle =
2166 , SansSerif
2166 , SansSerif
2167 ]
2167 ]
2168 in
2168 in
2169− [ StyleClass Flag.bgColor (Colored ("bg-color-" ++ formatColorClass (Rgba 1 1 1 0)) "background-color" (Rgba 1 1 1 0))
2169+ [ StyleClass Flag.bgColor (Colored ("bg-" ++ formatColorClass (Rgba 1 1 1 0)) "background-color" (Rgba 1 1 1 0))
2170− , StyleClass Flag.fontColor (Colored ("font-color-" ++ formatColorClass (Rgba 0 0 0 1)) "color" (Rgba 0 0 0 1))
2170+ , StyleClass Flag.fontColor (Colored ("fc-" ++ formatColorClass (Rgba 0 0 0 1)) "color" (Rgba 0 0 0 1))
2171 , StyleClass Flag.fontSize (FontSize 20)
2171 , StyleClass Flag.fontSize (FontSize 20)
2172 , StyleClass Flag.fontFamily <|
2172 , StyleClass Flag.fontFamily <|
2173 FontFamily (List.foldl renderFontClassName "font-" families)
2173 FontFamily (List.foldl renderFontClassName "font-" families)
@@ -2727,29 +2727,11 @@ renderStyleRule options rule maybePseudo =
2727 ]
2727 ]
2728
2728
2729 Colored class prop color ->
2729 Colored class prop color ->
2730− -- This is because the trick we're using to make a txtarea be height:content
2731− -- stops the inheritance chain for font color.
2732− -- So we need to pack our bags, hike up our socks and jump over the break.
2733− if prop == "color" then
2734− List.concat
2735− [ renderStyle options
2730+ renderStyle options
2736− maybePseudo
2737− ("." ++ class)
2738− [ Property prop (formatColor color)
2739− ]
2740− , renderStyle options
2741− maybePseudo
2742− ("." ++ class ++ " ." ++ classes.inputMultilineParent ++ " ." ++ classes.inputMultiline)
2743− [ Property prop (formatColor color)
2744− ]
2745− ]
2746−
2747− else
2748− renderStyle options
2749− maybePseudo
2731+ maybePseudo
2750− ("." ++ class)
2732+ ("." ++ class)
2751− [ Property prop (formatColor color)
2733+ [ Property prop (formatColor color)
2752− ]
2734+ ]
2753
2735
2754 SpacingStyle cls x y ->
2736 SpacingStyle cls x y ->
2755 let
2737 let
src/Internal/Style.elm+2−1
@@ -254,6 +254,7 @@ classes =
254 , inputText = "it"
254 , inputText = "it"
255 , inputMultiline = "iml"
255 , inputMultiline = "iml"
256 , inputMultilineParent = "imlp"
256 , inputMultilineParent = "imlp"
257+ , inputMultilineFiller = "imlf"
257
258
258 -- link
259 -- link
259 , link = "lnk"
260 , link = "lnk"
@@ -1564,7 +1565,7 @@ baseSheet =
1564 , Descriptor (dot classes.inputMultilineParent)
1565 , Descriptor (dot classes.inputMultilineParent)
1565 [ Prop "white-space" "pre-wrap"
1566 [ Prop "white-space" "pre-wrap"
1566 , Prop "cursor" "text"
1567 , Prop "cursor" "text"
1567− , Descriptor (dot classes.paragraph)
1568+ , Child (dot classes.inputMultilineFiller)
1568 [ Prop "white-space" "pre-wrap"
1569 [ Prop "white-space" "pre-wrap"
1569 , Prop "color" "transparent"
1570 , Prop "color" "transparent"
1570 ]
1571 ]