In R3 2016 SP1 when a RadEditor with RenderMode=Classic is disposed and RadScriptManager is used, a JavaScript error is thrown:
IE: Object doesn't support property or method 'dispose'
Chrome: Uncaught TypeError: this._contextMenuFunctionality.dispose is not a function
FIXED in R3 2016 SP2 (2016.3.1027)
There are three workarounds:
- Set EnableScriptCombine to false for the RadScriptManager (not applicable when CDN is used)
- OR set RenderMode=Lightweight for the RadEditor (you can do this in the web.config for all control instance in the web app if they do not define the Classic mode exiplicitly)
- OR add the following function override at the end of your page:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" >
</telerik:RadScriptManager>
<%-- WORKAROUND 1: SET EnableScriptCombine="false" TO RADSCRIPTMANAGER--%>
<asp:Button ID="Button1" Text="click to postback and break the editor" runat="server" />
<telerik:RadEditor ID="txtInstructions" runat="server">
</telerik:RadEditor>
<%-- WORKAROUND 2: SET RenderMode="Lightweight" TO RADEDITOR--%>
<%--WORKAROUND 3: ADD THE FOLLOWING SCRIPT TO THE END OF THE FORM--%>
<script>
Telerik.Web.UI.Editor.DefaultToolAdapter.prototype.dispose = function ()
{
delete this._fakeToolbarParentCreated;
var toolbars = this._getToolBarElements();
if (toolbars) {
for (var i = 0; i < toolbars.length; i++) {
$clearHandlers(toolbars[i]);
}
}
this._tools = [];
this._disposeToolbarModeHandlers();
var wnd = this._toolbarHolder;
if (wnd && wnd.dispose) wnd.dispose();
var contextMenuFunctionality = this._contextMenuFunctionality;
if (contextMenuFunctionality && contextMenuFunctionality.dispose) contextMenuFunctionality.dispose();
Telerik.Web.UI.Editor.DefaultToolAdapter.callBaseMethod(this, "dispose");
}
</script>