title: Custom Dialog box for WordPress Visual Editor
body: <p>I'm trying to add a button to the WordPress Visual Editor that will bring up a dialog box which will let the user select some options, and then click a button to insert some content based on those options.</p>
  
  <p>I've been able to bring up the dialog box by putting this in my functions:</p>
  
  <pre><code>    &lt;?php
      function fp_plugin_function_callback() { ?&gt;
      &lt;p&gt;&lt;select name="my_dialog_options"&gt;
  &lt;option value="1"&gt;First option&lt;/option&gt;
  &lt;option value="2"&gt;Second option&lt;/option&gt;
  &lt;option value="3"&gt;Third option&lt;/option&gt;
  &lt;/select&gt;&lt;/p&gt;
              &lt;p&gt;&lt;input type="submit" class="button-primary" value="Go" /&gt;&lt;/p&gt;        
      &lt;?php }
  
      add_action('wp_ajax_fp_plugin_function', 'fp_plugin_function_callback');
      ?&gt;
  </code></pre>
  
  <p>And with this javascript:</p>
  
  <pre><code>   (function() {
      tinymce.create('tinymce.plugins.fp_split_content', {
          init : function(ed, url) {
              ed.addButton('fp_split_content', {
                  title : 'Insert Split Content',
                  image : url+'/images/split.png',
                  onclick : function() {
                      ed.windowManager.open({
                          file: ajaxurl + '?action=fp_plugin_function',
                          width : 400 + parseInt(ed.getLang('highlight.delta_width', 0)),
                          height : 400 + parseInt(ed.getLang('highlight.delta_height', 0))
                          });
                      var content = ed.selection.getContent({format : 'html'});
                          ed.execCommand('mceInsertContent', false, content);
                  }
              });
          },
          createControl : function(n, cm) {
              return null;
          }
      });
      tinymce.PluginManager.add('fp_split_content', tinymce.plugins.fp_split_content);
  })();
  </code></pre>
  
  <p>What I can't find the answer to is how to get the options selected by the user into the visual editor.</p>