Completed
Last Updated: 13 Feb 2024 09:35 by ADMIN
ADMIN
Marin Bratanov
Created on: 19 Oct 2016 14:37
Category: Editor
Type: Bug Report
1
JavaScript error when dispsing RadEditor with RenderMode=Classic and RadScriptManager with EnableScriptCombine=true
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>
6 comments
ADMIN
Attila Antal
Posted on: 13 Feb 2024 09:35

IMPORTANT

Old versions of Telerik are vulnerable and we urge you to upgrade to at least version R1 2020 (2020.1.114) as described in the Allows JavaScriptSerializer Deserialization article. Doing so, the issue reported in this article will also be gone.

Regards,
Attila Antal
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
SUNIL
Posted on: 12 Feb 2024 20:02

I had a 2016.3.1018.45 version and I was getting the same issue. The way I permanently fixed this issue was by adding the code below in the pageload event of the aspx page that was having this issue. I simply added an if around the call to dispose method and the error disappeared. The reason for this error is that in some situations there was no method by the name of dispose under the object this._contextMenuFunctionality

 

I am overriding Telerik.Web.UI.Editor.DefaultToolAdapter.prototype.dispose method from which this error was happening.

 

 

function pageLoad(sender, args) {

if (Telerik.Web.UI.Editor && Telerik.Web.UI.Editor && Telerik.Web.UI.Editor.DefaultToolAdapter) {
Telerik.Web.UI.Editor.DefaultToolAdapter.prototype.dispose = function () {
delete this._fakeToolbarParentCreated;
var A = this._getToolBarElements();
if (A) {
for (var z = 0; z < A.length; z++) {
$clearHandlers(A[z]);
}
}
this._tools = [];
this._disposeToolbarModeHandlers();
var B = this._toolbarHolder;
if (B && B.dispose) {
B.dispose();
}
//made the change below. calling dispose within the if below else we were getting that
//this._contextMenuFunctionality.dispose is not a function
if (this._contextMenuFunctionality && this._contextMenuFunctionality.dispose) {
this._contextMenuFunctionality.dispose();
}
Telerik.Web.UI.Editor.DefaultToolAdapter.callBaseMethod(this, "dispose");
}
}

}

ADMIN
Marin Bratanov
Posted on: 27 Oct 2016 13:27
We just released R3 2016 SP2 (2016.3.1027) - an official service pack with this issue fixed.
dsb
Posted on: 26 Oct 2016 10:38
None of the workarounds worked for me.  Rolled back to 2016_3_914.  Hopefully a fix is in the works.
Michele
Posted on: 24 Oct 2016 12:48
EnableScriptCombine="false"  in iis8.5 windows server 2012R2 not working
in local mode work correctly
Alberto
Posted on: 20 Oct 2016 22:45
<%-- WORKAROUND 1: SET EnableScriptCombine="false" TO RADSCRIPTMANAGER--%>

Did the job. Thanks !