diff --git a/js/customize-post-section.js b/js/customize-post-section.js index ae6965b..03ebd00 100644 --- a/js/customize-post-section.js +++ b/js/customize-post-section.js @@ -558,11 +558,15 @@ * Update the editor when the setting changes its state. */ setting.bind( function( newPostData, oldPostData ) { - var editor; + var editor, textarea = $( '#customize-posts-content' ); if ( control.editorExpanded.get() && ! control.editorSyncSuspended && newPostData.post_content !== oldPostData.post_content ) { control.editorSyncSuspended = true; editor = tinyMCE.get( 'customize-posts-content' ); - editor.setContent( wp.editor.autop( newPostData.post_content ) ); + if ( editor && ! editor.isHidden() ) { + editor.setContent( wp.editor.autop( newPostData.post_content ) ); + } else { + textarea.val( newPostData.post_content ); + } control.editorSyncSuspended = false; } } ); @@ -579,7 +583,11 @@ $( document.body ).toggleClass( 'customize-posts-content-editor-pane-open', expanded ); if ( expanded ) { - editor.setContent( wp.editor.autop( setting().post_content ) ); + if ( editor && ! editor.isHidden() ) { + editor.setContent( wp.editor.autop( setting().post_content ) ); + } else { + textarea.val( setting().post_content ); + } editor.on( 'input change keyup', control.onVisualEditorChange ); textarea.on( 'input', control.onTextEditorChange ); control.resizeEditor( window.innerHeight - editorPane.height() );