on master help sign in
Expose toTypefaces and toLine for use within the core libraries
9df2eacEvan Czaplicki
libraries/Native/Text.js+7−5
@@ -66,9 +66,8 @@ Elm.Native.Text.make = function(elm) {
66 }
66 }
67 function toLine(line) {
67 function toLine(line) {
68 var ctor = line.ctor;
68 var ctor = line.ctor;
69− var decoration = ctor === 'Under' ? 'underline' :
69+ return ctor === 'Under' ? 'underline' :
70− ctor === 'Over' ? 'overline' : 'line-through';
70+ ctor === 'Over' ? 'overline' : 'line-through';
71− return 'text-decoration:' + decoration + ';';
72 }
71 }
73
72
74 // setting styles of Text
73 // setting styles of Text
@@ -87,7 +86,7 @@ Elm.Native.Text.make = function(elm) {
87 newText += 'font-style:italic;';
86 newText += 'font-style:italic;';
88 }
87 }
89 if (style.line.ctor !== 'Nothing') {
88 if (style.line.ctor !== 'Nothing') {
90− newText += toLine(style.line._0);
89+ newText += 'text-decoration:' + toLine(style.line._0) + ';';
91 }
90 }
92 newText += '">' + Utils.makeText(text) + '</span>'
91 newText += '">' + Utils.makeText(text) + '</span>'
93 return Utils.txt(newText);
92 return Utils.txt(newText);
@@ -111,7 +110,7 @@ Elm.Native.Text.make = function(elm) {
111 return { href: toText(href), text:text };
110 return { href: toText(href), text:text };
112 }
111 }
113 function line(line, text) {
112 function line(line, text) {
114− return { style: toLine(line), text:text };
113+ return { style: 'text-decoration:' + toLine(line) + ';', text:text };
115 }
114 }
116
115
117 function color(color, text) {
116 function color(color, text) {
@@ -161,5 +160,8 @@ Elm.Native.Text.make = function(elm) {
161 centered : block('center'),
160 centered : block('center'),
162 justified : block('justify'),
161 justified : block('justify'),
163 markdown : markdown,
162 markdown : markdown,
163+
164+ toTypefaces:toTypefaces,
165+ toLine:toLine,
164 };
166 };
165};
167};