Not rendering text HTML editor

Hi,
we’ve upgraded our version from 7.10.22 to 7.11.21.

We’ve found one possible bug related to displaying HTML editor on textarea fields.
image

It looks like javascript which is injected by include/SugarTinyMCE.php is not working properly. We’ve found the document.ready block is closed to early.

If you look at the following code:

$(document).ready(function(){

  if (!SUGAR.ajaxUI.hist_loaded){
	load_mce_{$unique}();
	}
});
if (SUGAR.ajaxUI && SUGAR.ajaxUI.hist_loaded){
setTimeout(function(){ load_mce_{$unique}();},40);
}
function load_mce_{$unique}(){

you can see the ready is closing before second if block. It results with no load_mce_? being called. In our case, hist_loaded was true after entering $(document).ready so it never enters the block and calls related load_mce function.

If second if is called immediately (before document being ready), hist_loaded is always undefined and load_mce is skipped again.

After removing ready closing }); and placing it below load_mce function definition, it works as expected.

So this is the new code:

 $(document).ready(function(){        
      if (!SUGAR.ajaxUI.hist_loaded){
        load_mce_{$unique}();
       }   

    if (SUGAR.ajaxUI && SUGAR.ajaxUI.hist_loaded){

        setTimeout(function(){ load_mce_{$unique}();},40);

    }

    function load_mce_{$unique}(){
    .......
    }); //new placement of closing brackets

With this we removed the load_mce_? function from global scope, and set both if blocks to be performed when page is ready. Does anyone else have the same problem? Can we fix it like this?

We have Installed fresh SuiteCRM 7.11.21 on our Server and It’s working perfectly. It looks like you have upgraded your SuiteCRM Version from 7.10.22 to 7.11.21. So it might be that the TinyMCE Javascript file is not updated. Can you copy the updated TinyMCE Javascript file from the fresh SuiteCRM 7.11.21 source code and replace it in your SuiteCRM.