Fixed problem with building TW under Windows

Fixes #717

The issue was that under Windows we generate text nodes that contained
CRLF as a linebreak (rather than just LF as usual).

The subtle problem is that when these strings are placed in the DOM via
createTextNode(), the CR character is treated as a printable character,
not whitespace. When creating DOM notes with innerHTML or as part of a
static HTML document the HTML parser will strip out the CR characters.

The hacky solution is to manually remove CRs before building the text
node.
print-window-tiddler
Jermolene 2014-08-15 09:40:22 +01:00
rodzic 592cdc4617
commit c8830d32f7
1 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -30,8 +30,9 @@ TextNodeWidget.prototype.render = function(parent,nextSibling) {
this.parentDomNode = parent;
this.computeAttributes();
this.execute();
var text = this.getAttribute("text",this.parseTreeNode.text),
textNode = this.document.createTextNode(text);
var text = this.getAttribute("text",this.parseTreeNode.text);
text = text.replace(/\r/mg,"");
var textNode = this.document.createTextNode(text);
parent.insertBefore(textNode,nextSibling);
this.domNodes.push(textNode);
};