From 5c4cff0a293549759d483713e812b47a05a5e01f Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Fri, 22 Mar 2013 20:43:37 +0000 Subject: [PATCH] Editor: fix switching Text to Visual and back if TinyMCE fails to initialise, fixes #23235 git-svn-id: https://develop.svn.wordpress.org/trunk@23790 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/js/editor.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wp-admin/js/editor.js b/wp-admin/js/editor.js index bd71cc87bd..e54e836cc2 100644 --- a/wp-admin/js/editor.js +++ b/wp-admin/js/editor.js @@ -49,8 +49,15 @@ var switchEditors = { if ( ed && ed.isHidden() ) return false; - if ( ed ) + if ( ed ) { ed.hide(); + } else { + // The TinyMCE instance doesn't exist, run the content through "pre_wpautop()" and show the textarea + if ( tinyMCEPreInit.mceInit[id] && tinyMCEPreInit.mceInit[id].wpautop ) + txtarea_el.value = t.pre_wpautop( txtarea_el.value ); + + dom.setStyles(txtarea_el, {'display': '', 'visibility': ''}); + } dom.removeClass(wrap_id, 'tmce-active'); dom.addClass(wrap_id, 'html-active');