Always switch out Text elements

This commit is contained in:
Evan Czaplicki 2013-11-02 23:17:29 +01:00
parent dd9c90d457
commit ef2b38fe11
2 changed files with 7 additions and 2 deletions

View file

@ -96,7 +96,7 @@ Elm.Native.Text.make = function(elm) {
var raw = {
ctor:'RawHtml',
html: '<span style="text-align:' + align + ';">' + text + '</span>',
guid: '0',
guid: null,
args: [],
};
var pos = A2(Utils.htmlHeight, 0, raw);

View file

@ -205,6 +205,11 @@ function update(node, curr, next) {
switch(nextE.ctor) {
case "Spacer": break;
case "RawHtml":
// only markdown blocks have guids, so this must be a text block
if (nextE.guid === null) {
node.innerHTML = nextE.html;
break;
}
if (nextE.guid !== currE.guid) {
node.parentNode.replaceChild(render(next),node);
return true;
@ -267,7 +272,7 @@ function update(node, curr, next) {
}
break;
case "Container":
update(node.firstChild, currE._1, nextE._1)
update(node.firstChild, currE._1, nextE._1);
setPos(nextE._0, nextE._1.props.width, nextE._1.props.height, node.firstChild);
break;
case "Custom":