The NewLine command behave inconsistently across browsers and causes different incorrect content generation in IE, Chrome and Safari.
- In IE - New lines are added, but the cursor stays in the initial/first line. This issue also causes an performance problems when typing and pressing Enter with regular speed.
- In Chrome - Pressing Enter causes mixed content of tracked and not-tracked text to appear without toggling the state of the Track Changes. Also, adds an empty INS tag in from of the new line.
- In Safari - Adds an empty INS tag in from of the new line.
For the time being you can incorporate the JavaScript code from the following example:
<telerik:RadEditor runat="server" ID="RadEditor1" EnableTrackChanges="true">
<Tools>
<telerik:EditorToolGroup>
<telerik:EditorTool name="AcceptTrackChange" text="Accept Track Change" />
<telerik:EditorTool name="RejectTrackChange" text="Reject Track Change" />
<telerik:EditorTool name="AcceptAllTrackChanges" text="Accept All Track Changes" />
<telerik:EditorTool name="RejectAllTrackChanges" text="Reject All Track Changes" />
<telerik:EditorTool name="EnableTrackChangesOverride" text="Enable Track Changes Override" />
</telerik:EditorToolGroup>
</Tools>
</telerik:RadEditor>
<script type="text/javascript">
(function () {
var $E = Telerik.Web.UI.Editor;
var utils = $E.Utils;
var isTypingKey = utils.isTypingKey;
utils.isTypingKey = function (e) {
return e.keyCode != 13 && isTypingKey(e);
}
var extractFrom = $E.InsertParagraphCommand.prototype.extractFrom;
$E.InsertParagraphCommand.prototype.extractFrom = function (cursor, container) {
var newElement = extractFrom.call(this, cursor, container);
if (!this.get_editor().get_enableTrackChanges() || utils.isTextNode(cursor.nextSibling)) return newElement;
$telerik.$(newElement).find("*").each(function (index, item) {
if ($E.TrackChangesUtils.isTrackChangeElement(item)) {
if (utils.isTag(item, "ins") || utils.isTag(item, "del")) {
utils.removeNode(item);
return;
}
$E.TrackChangesUtils.removeNodeTracking(item);
}
});
return newElement;
}
}());
</script>