Support » Plugin: Import and export users and customers » “Load subject, content and attachment from this email template” JS error

  • Resolved bretweinraub99

    (@bretweinraub99)


    Clicking this button throws

    
    ncaught TypeError: Cannot read property 'setContent' of null
        at Object.success (email-template-attachment-admin.js?ver=d06708e94f214c25ca58e211a9134360:53)
        at i (load-scripts.php?c=0&load[chunk_0]=jquery-core,utils,moxiejs,plupload&ver=d06708e94f214c25ca58e211a9134360:2)
        at Object.fireWith [as resolveWith] (load-scripts.php?c=0&load[chunk_0]=jquery-core,utils,moxiejs,plupload&ver=d06708e94f214c25ca58e211a9134360:2)
        at x (load-scripts.php?c=0&load[chunk_0]=jquery-core,utils,moxiejs,plupload&ver=d06708e94f214c25ca58e211a9134360:4)
        at XMLHttpRequest.c (load-scripts.php?c=0&load[chunk_0]=jquery-core,utils,moxiejs,plupload&ver=d06708e94f214c25ca58e211a9134360:4)
    

    from this block in

    
    	$( '#load_email_template' ).click( function(){
    		if( $( '#email_template_selected' ).val() == '' )
    			return;
    
    		var data = {
    			'action': 'acui_email_template_selected',
    			'email_template_selected': $( '#email_template_selected' ).val(),
    			'security': email_template_attachment_admin.security,
    		};
    
    		$.post( ajaxurl, data, function( response ) {
    			var response = JSON.parse( response );
    			$( '#title' ).val( response.title );
    			tinyMCE.get( 'body_mail' ).setContent( response.content );
    			$( '#email_template_attachment_id' ).val( response.attachment_id );
    			if( response.attachment_url != '' ){
    				$( '#email_template_attachment_file' ).val( response.attachment_url );
    			}
    			$( '#template_id' ).val( response.id );
    			$( '#save_mail_template_options' ).click();
    		});
    	} );
    

    specifically:

    tinyMCE.get( ‘body_mail’ ).setContent( response.content );

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter bretweinraub99

    (@bretweinraub99)

    Here’s the textarea tag:

    
    <textarea class="wp-editor-area" rows="20" autocomplete="off" cols="40" name="body_mail" id="body_mail" edit_id="eta_0" spellcheck="false">
    

    so it should work ….. but it doesn’t

    Plugin Author Javier Carazo

    (@carazo)

    Good morning @bretweinraub99,

    In our test sites this is working correctly.

    Maybe you have another plugin or your theme interacting.

    Could you check?

    Thread Starter bretweinraub99

    (@bretweinraub99)

    Could be, I’ll have a look.

    Thread Starter bretweinraub99

    (@bretweinraub99)

    I disabled all my plugins but this one, and switched back to theme 2020, and the problem persists.

    Plugin Author Javier Carazo

    (@carazo)

    This is really strange, in all the sites we have this working, it works with no problems.

    It seems to be some problem with TinyMCE. Can you try to install “Classic Editor” plugin and test again?

    Thread Starter bretweinraub99

    (@bretweinraub99)

    yes

    Thread Starter bretweinraub99

    (@bretweinraub99)

    well it looks like tinyMCE is broken everywhere…..

    Thread Starter bretweinraub99

    (@bretweinraub99)

    so I’d say close this

    Plugin Author Javier Carazo

    (@carazo)

    @bretweinraub99,

    OK. Could you solve installing Classic Editor?

    Thread Starter bretweinraub99

    (@bretweinraub99)

    No, that wasn’t working either. I wonder if the jquery-migrate-helper might help, will try that and report back.

    Plugin Author Javier Carazo

    (@carazo)

    There is something in your site which breaks the TinyMCE.

    Thread Starter bretweinraub99

    (@bretweinraub99)

    OK, I think I solved it.

    If you have selected “text” in the editor window of the email template, the button doesn’t work. But if you select “visual”, it works fine. Can you check it?

    For my, when I select “text’, in the JS console tinyMCE.editors becomes empty, click visual, and it is suddenly non-empty.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘“Load subject, content and attachment from this email template” JS error’ is closed to new replies.