From c0ca932fe120bb56860b3038e6aff4359c021ea0 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 16 Oct 2012 22:01:30 +0000 Subject: [PATCH] Editor: fix setting wpActiveEditor when TinyMCE is not used, see #21718 git-svn-id: https://develop.svn.wordpress.org/trunk@22251 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/class-wp-editor.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/wp-includes/class-wp-editor.php b/wp-includes/class-wp-editor.php index 8a55b7a1a8..d80a7f8a8b 100644 --- a/wp-includes/class-wp-editor.php +++ b/wp-includes/class-wp-editor.php @@ -608,10 +608,12 @@ final class _WP_Editors { try { tinymce.init(init); } catch(e){} } } else { - el = document.getElementsByClassName('wp-editor-wrap'); - for ( i in el ) { - if ( typeof(el[i]) == 'object' ) - el[i].onmousedown = function(){ wpActiveEditor = this.id.slice(3, -5); } + if ( tinyMCEPreInit.qtInit ) { + for ( i in tinyMCEPreInit.qtInit ) { + el = tinyMCEPreInit.qtInit[i].id; + if ( el ) + document.getElementById('wp-'+el+'-wrap').onmousedown = function(){ wpActiveEditor = this.id.slice(3, -5); } + } } }