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.
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?