title: Adding wp_editor inside a thickbox
body: <p>I would like to add a wp_editor inside a modal dialog (thickbox) at frontend but only gets an empty editor with no buttons on in. (WordPress 3.5 and plugin development)</p>
  
  <p>The wp_editor is attached via an ajax call...</p>
  
  <p>It seems like some important javascripts is missing to the page.</p>
  
  <p>Is it possible to preload editor scripts i WP in some way?</p>
  
  <p>Here is a sample plugin to expose the problem (adds a edit link to every content):</p>
  
  <pre><code>&lt;?php
  /*
  Plugin Name: ThickboxEditor
  */
  
  $thickboxeditor = new ThickboxEditor();
  
  class ThickboxEditor{
  
      function __construct()
      {
  
          add_action( 'wp_print_styles', array( &amp;$this, 'wp_print_styles' ) );
          add_action( 'init', array( &amp;$this, 'init' ) );
          add_filter( 'the_content', array( &amp;$this, 'the_content' ) );
          add_action( 'wp_ajax_thickboxeditor', array( &amp;$this, 'editor' ) );
          add_action( 'wp_ajax_nopriv_thickboxeditor', array( &amp;$this, 'editor' ) );
  
      }
  
      function the_content( $content ){
  
          $content .= '&lt;a href="' . admin_url( 'admin-ajax.php' ) . '?action=thickboxeditor" class="thickbox" title="Add new note"&gt;EDIT THICKBOXEDITOR&lt;/a&gt;';
  
          return $content;
  
      }
  
      function editor(){
  
          wp_editor( $this-&gt;postcontent, 'postcontent', array(
              'media_buttons' =&gt; false,
              'teeny' =&gt; false,
              'textarea_rows' =&gt; '7',
              'tinymce' =&gt; array( 'plugins' =&gt; 'inlinepopups, fullscreen, wordpress, wplink, wpdialogs' )
          ) );
  
          die(0);
  
      }
  
  }
  ?&gt;
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Thanks to @danielauener one solution is to initialize mceAddControl. So here is a working sample of the same plugin:</p>
  
  <pre><code>&lt;?php
  /*
  Plugin Name: ThickboxEditor
  */
  
  $thickboxeditor = new ThickboxEditor();
  
  class ThickboxEditor{
  
      function __construct()
      {
  
          add_action( 'wp_print_styles', array( &amp;$this, 'wp_print_styles' ) );
          add_action( 'init', array( &amp;$this, 'init' ) );
          add_filter( 'the_content', array( &amp;$this, 'the_content' ) );
          add_action( 'wp_ajax_thickboxeditor', array( &amp;$this, 'editor' ) );
          add_action( 'wp_ajax_nopriv_thickboxeditor', array( &amp;$this, 'editor' ) );
          add_action( 'wp_footer', array( &amp;$this, 'wp_footer' ) );
  
      }
  
      function wp_footer(){
  
          echo '&lt;!--';
          wp_editor( '', 'invisible_editor_for_initialization' );
          echo '--&gt;';
  
      }
  
      function the_content( $content ){
  
          $content .= '&lt;a href="' . admin_url( 'admin-ajax.php' ) . '?action=thickboxeditor" class="thickbox" title="Add new note"&gt;EDIT THICKBOXEDITOR&lt;/a&gt;';
  
          return $content;
  
      }
  
      function editor(){
  
          wp_editor( '', 'postcontent', array(
              'media_buttons' =&gt; false,
              'teeny' =&gt; false,
              'textarea_rows' =&gt; '7',
              'tinymce' =&gt; array( 'plugins' =&gt; 'inlinepopups, fullscreen, wordpress, wplink, wpdialogs' )
          ) );
  
          ?&gt;
  
          &lt;script language="javascript"&gt;
              jQuery(document).ready(function(){
                  tinymce.execCommand('mceAddControl',true,'postcontent');
              });
          &lt;/script&gt;
  
          &lt;?php
  
          die(0);
  
      }
  
  }
  ?&gt;
  </code></pre>
  
  <p>It would be really nice to skip the ugly wp_editor initialization :-)</p>