Completed
Last Updated: 11 Feb 2019 10:07 by ADMIN
Bruce Timmins
Created on: 24 Jan 2019 21:14
Category: Editor
Type: Bug Report
0
R.get_canAcceptTrackChange is not a function error when using ToolProviderID

I've been trying to upgrade an existing solution to use the latest release version (2019) of the Telerik UI for ASP.NET AJAX and have encountered a major problem with the 'Tool Provider', a technique which is significantly used in my solution.  This same error displays in your own Telerik Demo.  Details are:

 

Description of the issue

Having multiple RadEditors on the same page, and trying the property "ToolProviderID" (to reuse the same floating tool amongst the different editors on the same page), causes a "javascript exception" on the client side.


   
URL of the Demo (Telerik Website)

https://demos.telerik.com/aspnet-ajax/editor/examples/toolprovider/defaultcs.aspx



Exception description

Uncaught TypeError: R.get_canAcceptTrackChange is not a function at c.RadEditor._initializeToolProvider (RadEditor.js:8239) at c.RadEditor.initialize (RadEditor.js:8297) at c.RadEditor.endUpdate (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6) at Sys._Application.endCreateComponents (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6) at Sys.WebForms.PageRequestManager._scriptsLoadComplete (Telerik.Web.UI.WebRe97d4b%3ab25378d2:15) at Sys.WebForms.PageRequestManager.<anonymous> (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6) at Telerik.Web.UI.WebRe597d4b%3ab25378d2:6 at Sys._ScriptLoader._loadScriptsInternal (Telerik.Web.UI.WebRe97d4b%3ab25378d2:15) at Sys._ScriptLoader._loadScriptsInternal (Telerik.Web.UI.WebRe97d4b%3ab25378d2:15) at Sys._ScriptLoader._loadScriptsInternal (Telerik.Web.UI.WebRe97d4b%3ab25378d2:15)
    



How to reproduce the error (on Telerik demo website)

    - Mark the checkbox at the bottom of the page and click on "Update":

(the error can be seem on console, pressing F12)




Error message happening in our system

RadEditor.js:8239 Uncaught TypeError: R.get_canAcceptTrackChange is not a function at c.RadEditor._initializeToolProvider (RadEditor.js:8239) at c.RadEditor.initialize (RadEditor.js:8297) at c.RadEditor.endUpdate (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6) at Sys._Application.endCreateComponents (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6) at Sys._Application._raiseInit (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6) at Sys._Application.initialize (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6) at b (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6) at HTMLDocument.a (Telerik.Web.UI.WebRe597d4b%3ab25378d2:6)
   



Sample code, causing the issue (our system)

Refer the attached image.

Attached Files:
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
2 comments
ADMIN
Rumen
Posted on: 11 Feb 2019 10:07
Hi all,

I am following up with good news that the problem is fixed in the Latest Internal Build (Telerik_UI_for_ASP.NET_AJAX_2019_1_211_Dev|Trial_hotfix.zip) which precedes the R1 2019 Service Pack 1 release.
You can download the nightly build from here (press the the Internal Builds tab to locate the build).

The release notes are here.

Please let us know if you find any issues or side effects with the hotfix.

Best regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
ADMIN
Rumen
Posted on: 25 Jan 2019 18:00
Hello Bruce,

Thank you for reporting this regression and the detailed instruction!

The problem will be fixed in the upcoming R1 2019 SP1 release, due on Feb 20.

As a temporary workaround I would provide the following override that will fix the error:

<script>
    var $T = Telerik.Web.UI;
    var TOOLBAR_SELECTOR = ".reToolbar,.reToolBar";
    $T.RadEditor.prototype._initializeToolProvider = function () {
        var editor = this;
        var toolProviderID = editor.get_toolProviderID();
        var provider = toolProviderID ? $find(toolProviderID) : null;
 
        if (!provider) {
            return;
        }
 
        var getToolBarHolder = function (adapter) {
            var wnd = adapter.get_window();
            return wnd ? wnd.get_contentElement() : adapter.get_element();
        };
        var toolAdapter = editor.get_toolAdapter();
        var providerToolAdapter = provider ? provider.get_toolAdapter() : null;
        var providerToolBarHolder = getToolBarHolder(providerToolAdapter);
        var providerToolBarElements = providerToolBarHolder ? $(providerToolBarHolder).find(TOOLBAR_SELECTOR) : [];
        var providerToolBarsLength = providerToolBarElements.length;
        var toolsFragment = document.createDocumentFragment();
 
        editor.set_dialogOpener(provider.get_dialogOpener());
 
        var contextJSON = provider.get_contextMenusJSON();
 
        if (contextJSON && contextJSON.concat) {
            editor.set_contextMenusJSON(contextJSON.concat([]));
        }
 
        var modulesJSON = provider.get_modulesJSON();
 
        if (modulesJSON && modulesJSON.concat) {
            editor.set_modulesJSON(modulesJSON.concat([]));
        }
 
        editor.set_toolJSON(provider.get_toolJSON());
        toolAdapter.set_toolJSON(provider.get_toolAdapter().get_toolJSON());
 
        var toolBarContent = getToolBarHolder(toolAdapter);
 
        for (var i = 0; i < providerToolBarsLength; i++) {
            $(providerToolBarElements[i]).clone().appendTo(toolsFragment);
        }
 
        $(toolBarContent).append(toolsFragment);
 
        if (provider.get_spellCheckJSON) {
            editor.set_spellCheckJSON(provider.get_spellCheckJSON());
        }
 
        if (provider.get_ajaxSpellCheckScriptReference) {
            var ref = provider.get_ajaxSpellCheckScriptReference();
 
            if (ref) {
                editor.set_ajaxSpellCheckScriptReference(ref);
            }
        }
 
        editor.set_links(provider.get_links());
        editor.set_colors(provider.get_colors());
        editor.set_fontNames(provider.get_fontNames());
        editor.set_fontSizes(provider.get_fontSizes());
        editor.set_symbols(provider.get_symbols());
        editor.set_realFontSizes(provider.get_realFontSizes());
        editor.set_snippets(provider.get_snippets());
        editor.set_cssClasses(provider.get_cssClasses());
        editor.set_cssFiles(provider.get_cssFiles());
        editor.set_languages(provider.get_languages());
        editor.set_paragraphs(provider.get_paragraphs());
        editor.set_formatSets(provider.get_formatSets());
        editor.set_enableUndoRedo(provider.get_enableUndoRedo());
    }
 
</script>
<telerik:RadEditor RenderMode="Lightweight" ID="RadEditor1" runat="server"

I also updated your Telerik points for the inconvenience and the bug report!

Best regards,
Rumen
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.