Expose toTypefaces and toLine for use within the core libraries
This commit is contained in:
parent
e53ebfca30
commit
9df2eac7c1
1 changed files with 7 additions and 5 deletions
|
@ -66,9 +66,8 @@ Elm.Native.Text.make = function(elm) {
|
||||||
}
|
}
|
||||||
function toLine(line) {
|
function toLine(line) {
|
||||||
var ctor = line.ctor;
|
var ctor = line.ctor;
|
||||||
var decoration = ctor === 'Under' ? 'underline' :
|
return ctor === 'Under' ? 'underline' :
|
||||||
ctor === 'Over' ? 'overline' : 'line-through';
|
ctor === 'Over' ? 'overline' : 'line-through';
|
||||||
return 'text-decoration:' + decoration + ';';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// setting styles of Text
|
// setting styles of Text
|
||||||
|
@ -87,7 +86,7 @@ Elm.Native.Text.make = function(elm) {
|
||||||
newText += 'font-style:italic;';
|
newText += 'font-style:italic;';
|
||||||
}
|
}
|
||||||
if (style.line.ctor !== 'Nothing') {
|
if (style.line.ctor !== 'Nothing') {
|
||||||
newText += toLine(style.line._0);
|
newText += 'text-decoration:' + toLine(style.line._0) + ';';
|
||||||
}
|
}
|
||||||
newText += '">' + Utils.makeText(text) + '</span>'
|
newText += '">' + Utils.makeText(text) + '</span>'
|
||||||
return Utils.txt(newText);
|
return Utils.txt(newText);
|
||||||
|
@ -111,7 +110,7 @@ Elm.Native.Text.make = function(elm) {
|
||||||
return { href: toText(href), text:text };
|
return { href: toText(href), text:text };
|
||||||
}
|
}
|
||||||
function line(line, text) {
|
function line(line, text) {
|
||||||
return { style: toLine(line), text:text };
|
return { style: 'text-decoration:' + toLine(line) + ';', text:text };
|
||||||
}
|
}
|
||||||
|
|
||||||
function color(color, text) {
|
function color(color, text) {
|
||||||
|
@ -161,5 +160,8 @@ Elm.Native.Text.make = function(elm) {
|
||||||
centered : block('center'),
|
centered : block('center'),
|
||||||
justified : block('justify'),
|
justified : block('justify'),
|
||||||
markdown : markdown,
|
markdown : markdown,
|
||||||
|
|
||||||
|
toTypefaces:toTypefaces,
|
||||||
|
toLine:toLine,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue