Steps to reproduce:
Use the following markup and click set html button:
<telerik:RadEditor ID="RadEditor1" runat="server" NewLineMode="Div">
<Content>
<div><span style="font-family: 'Courier New';">test</span></div>
<div><span style="font-family: 'Courier New';"> </span></div>
<div><span style="font-family: 'Courier New';">test</span></div>
</Content>
</telerik:RadEditor>
<button type="button" onclick="getSetHtml();return false;">set html</button>
<script>
function getSetHtml() {
var editor = $find("RadEditor1");
var html = editor.get_html(true);
editor.set_html(html);
}
</script>
Actual: The white space character in the empty line is removed and the empty line is not rendered
Expected: The space is not removed and the new line is rendered
Workaround:
<script>
(function ($E) {
var utils = $E.Utils;
Telerik.Web.UI.Editor.TrackerBase.prototype.removeZeroWidthNodes =
function () {
var that = this,
nodes = that.nodes,
reZeroWidthChar = new RegExp("^[" + that._zeroWidthCharacter + "]+$");
var nodeValuePairs = that.nodeValuePairs = [];
for (var i = 0; i < nodes.length; i++) {
var node = nodes[i];
if (utils.isTextNode(node) && !that._isNodeRemoved(node)) {
var nodeValue = node.nodeValue;
if (reZeroWidthChar.test(nodeValue)) {
nodeValuePairs.push({ node: node, value: node.nodeValue });
var parentBlockElement = utils.getBlockParent(node);
var isInEmptyBlockElement = parentBlockElement && utils.isNodeEmptyRecursive(parentBlockElement);
node.nodeValue = isInEmptyBlockElement ? "\u00A0" : "";
}
else {
that.removeFirstZeroWidthChar(node);
}
}
}
}
})(Telerik.Web.UI.Editor);
</script>