Support

Account

Home Forums Front-end Issues Frontend WYSIWYG Problems Reply To: Frontend WYSIWYG Problems

  • Thank you, Elliot for your previous help. I have come up with some more information. I understand that I am using some third party code, however I have tested this functionality with basic jQuery .post() methods. Each variant has the same result.

    Here is the status of the situation:

    • acf_form_head() is at the top of my file.
    • WordPress ajaxurl has been defined.
    • WordPress AJAX callback hooks are defined and working.
    • A button triggers the AJAX callback and appends the result to a DOM element.
    • On a successful WP nonce verification and AJAX callback, the HTML for an acf_form() is populated but the ACF WYSIWYGs are not correctly initialized.
    • It seems that the acf/setup_fields trigger performs successfully as the media uploaders and location fields initialize their scripts successfully.

    I edited your wysiwyg.js file to deliver some debugging information:

    // validate tinymce
    if( ! _wysiwyg.has_tinymce() )
    {
    	console.log( "FAILED TO VALIDATE TINYMCE" );
    	return;
    }

    This indeed returns a failure on the initial page load (as there are no ACF forms or WYSIWYGs). However, even after the AJAX callback has successfully completed, a failure is returned for the number of WYSIWYGs in the form. I am dumb when it comes to anything about tinyMCE. I tried an attempt to solve this within the AJAX success callback (before the `acf/setup_fields’ trigger):

    $('.acf_wysiwyg textarea').each(function() {
        tinymce.execCommand('mceAddControl', false, $(this).attr('id'));
    });

    Suggestions or thoughts? I absolutely love ACF and use it for many of my client’s projects (love the repeater fields). I would love to help you solve this issue for future users, so in the meantime, I will be diving into your source and seeing if I can come up with a solution. Feel free to offer your suggestions and move on. I will simply keep posting my findings here for other users (and hopefully we can get some community support on this issue).