I have a problem with a Sharepoint point page, which was setting in 2010. The mistake came for itself, there wasn’t any change in it’s source-code. The Windows server and the Sharepoint hasn’t been updated. The mistake begin with a a SP.UI.RTE.JS file. When I was searching for the name of the file, I found a lot of forums. From these I learned that this is a typical mistake, which has been for years, but none of the proposed solutions worked for me. You can see the error below (on the print screen):
I tried these fixes:
SP.SOD.executeFunc('sp.ui.rte.js', null, function () {
if (/var \$v_0 = RTE\.Selection\.getSelectionRange\(\);[\r\n\t ]*var \$v_1 = \$v_0\.parentElement\(\);/.test(RTE.Canvas.checkCurrentFocus.toString())) {
var _oldCheckCurrentFocus = RTE.Canvas.checkCurrentFocus;
RTE.Canvas.checkCurrentFocus = function () {
if(RTE.Selection.getSelectionRange())
return _oldCheckCurrentFocus();
};
}
});
function fixRTEBug() {
if (typeof RTE.Canvas.checkCurrentFocus !== 'undefined') {
RTE.Canvas.checkCurrentFocus = function() {ULSkay:;
var $v_0 = RTE.Selection.getSelectionRange();
if ($v_0) { //this is different from SP to avoid error in console
var $v_1 = $v_0.parentElement();
if (RTE.Canvas.isInEditable($v_1) && !RTE.Cursor.get_range().isValid()) {
RTE.Cursor.updateRangeToCurrentSelection();
RTE.Cursor.update();
}
}
}
}
// This Fix for parentElement bug in RTE should survive Service Packs and CU's
function SubstituteRTERangeParentElement() {
var originalRTERangeParentElement = RTE.Range.prototype.parentElement;
RTE.Range.prototype.parentElement = function () {
try {
originalRTERangeParentElement();
} catch (e) { }
}
}
SubstituteRTERangeParentElement();
}
ExecuteOrDelayUntilScriptLoaded(fixRTEBug, "sp.ui.rte.js");
function spUIRTESetStartEndBugFix() {
Range.prototype.setStartOld = Range.prototype.setStart;
Range.prototype.setStart = (function (a, b) { this.setStartOld(a, Math.min(b, this.endOffset)); });
Range.prototype.setEndOld = Range.prototype.setEnd;
Range.prototype.setEnd = (function (a, b) { this.setEndOld(a, Math.min(b, this.endOffset)); });
};
ExecuteOrDelayUntilScriptLoaded(spUIRTESetStartEndBugFix, "sp.ui.rte.js");