on master help sign in
Fix the default size of text blocks.
d2846a2evancz
libraries/Graphics/Element.elm+1−1
@@ -43,7 +43,7 @@ width : Int -> Element -> Element
43width nw e = let p = e.props
43width nw e = let p = e.props
44 props = case e.element of
44 props = case e.element of
45 Image _ w h _ -> {p| height <- h/w*nw }
45 Image _ w h _ -> {p| height <- h/w*nw }
46− RawHtml html -> {p| height <- htmlHeight nw html }
46+ RawHtml html -> {p| height <- let (w,h) = htmlHeight nw html in h}
47 _ -> p
47 _ -> p
48 in { element=e.element, props={props| width <- nw} }
48 in { element=e.element, props={props| width <- nw} }
49
49
libraries/Native/Graphics/Text.js+2−2
@@ -97,8 +97,8 @@ Elm.Native.Graphics.Text = function(elm) {
97 _0: '<div style="padding:0;margin:0;text-align:' +
97 _0: '<div style="padding:0;margin:0;text-align:' +
98 pos + '">' + text + '</div>'
98 pos + '">' + text + '</div>'
99 };
99 };
100− var w = elm.node.clientWidth;
100+ var p = A2(htmlHeight, 0, text);
101− return A3(Element.newElement, w, A2(htmlHeight, w, text), e);
101+ return A3(Element.newElement, p._0, p._1, e);
102 }
102 }
103 }
103 }
104
104
libraries/Native/Utils.js+6−5
@@ -99,15 +99,16 @@ Elm.Native.Utils = function(elm) {
99 function htmlHeight(width, html) {
99 function htmlHeight(width, html) {
100 var t = document.createElement('div');
100 var t = document.createElement('div');
101 t.innerHTML = html;
101 t.innerHTML = html;
102− t.style.width = width + "px";
102+ if (width > 0) { t.style.width = width + "px"; }
103 t.style.visibility = "hidden";
103 t.style.visibility = "hidden";
104 t.style.styleFloat = "left";
104 t.style.styleFloat = "left";
105 t.style.cssFloat = "left";
105 t.style.cssFloat = "left";
106
106
107− document.body.appendChild(t);
107+ elm.node.appendChild(t);
108+ var w = t.clientWidth;
108− var h = t.clientHeight
109+ var h = t.clientHeight;
109− document.body.removeChild(t);
110+ elm.node.removeChild(t);
110− return h;
111+ return Tuple2(w,h);
111 }
112 }
112
113
113 return elm.Native.Utils = {
114 return elm.Native.Utils = {
libraries/WebSocket.elm+3
@@ -8,3 +8,6 @@ import Native.WebSocket as WS
8-- web-socket server. The input signal holds the outgoing messages,
8-- web-socket server. The input signal holds the outgoing messages,
9-- and the resulting signal contains the incoming ones.
9-- and the resulting signal contains the incoming ones.
10open : String -> Signal String -> Signal String
10open : String -> Signal String -> Signal String
11+
12+-- data Action = Open String | Close String | Send String String
13+-- connections : Signal Action -> Signal String