Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have installed qtranslate on my wordpress site, it all works fine, but sometimes the content editor does not show the text, When I force refresh the page a few times (Ctrl + r) eventually the text shows up.

I was going to put images here to explain it but, this post already has the images I would put on, (however the questions differ) qtranslate is not working properly

I have deactivated all of the plugins, and this problem it's still there, I have tried alot of other things to

Error:

Uncaught TypeError: Cannot set property 'setup' of undefined
Line: 303, qtranslate_javascript.php

$q_config['js']['qtrans_hook_on_tinyMCE'] = "
qtrans_hook_on_tinyMCE = function(id) {

tinyMCEPreInit.mceInit[id].setup = function(ed) {
    ed.onSaveContent.add(function(ed, o) {
        if (!ed.isHidden())  {
            qtrans_save(switchEditors.pre_wpautop(o.content));
        }
    });
};
ed = new tinymce.Editor(id, tinyMCEPreInit.mceInit[id]);
    ed.render();
}
";

Console Logging ID:

qtrans_textarea_content post.php:467
qtrans_textarea_acf_settings 

Other notes

I have also tried to add the try{} catch(e){} to avoid the script from breaking down, it does not seem to help at all, I have run out of options and I really need some help with this

Cheers

share|improve this question
add comment

1 Answer

I have found a great post which solves this issue,

http://wordpress.org/support/topic/plugin-qtranslate-problems-displaying-in-the-edit?replies=21#post-3160564

The issue is on qtranslate_javascript.php line 225

Replace

var waitForTinyMCE = window.setInterval(function() {
                if(typeof(tinyMCE) !== 'undefined' && typeof(tinyMCE.get2) == 'function' && tinyMCE.get2('content')!=undefined) {
                    content=jQuery('#content').val();
                    tinyMCE.get2('content').remove();
                    jQuery('#content').val(content);
                    window.clearInterval(waitForTinyMCE);
                }
            }, 250);

WITH: Only change the 250 to 500 :) this should solve the problem...

var waitForTinyMCE = window.setInterval(function() {
                if(typeof(tinyMCE) !== 'undefined' && typeof(tinyMCE.get2) == 'function' && tinyMCE.get2('content')!=undefined) {
                    content=jQuery('#content').val();
                    tinyMCE.get2('content').remove();
                    jQuery('#content').val(content);
                    window.clearInterval(waitForTinyMCE);
                }
            }, 500);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.