• I have multiple tiny_mce instances on a metabox in the media-upload.php page.
    This works fine and displays / saves text fine by calling:

    wp_tiny_mce(true,
    	array(
        	"editor_selector" => "my_text_box"
      	)
    );

    The problem is that the hyperlink pop box doesn’t link correctly. The box pops up ok, but then when you click ‘add link’ the whole page refreshes.

    I think it’s down to the tiny_mce not targetting the text box because there are multiple instances of it.

    So I tried this method:

    // important: note the priority of 99, the js needs to be placed after tinymce loads
    add_action('admin_print_footer_scripts','my_admin_print_footer_scripts',99);
    function my_admin_print_footer_scripts() {
    	?><script type="text/javascript">/* <![CDATA[ */
    		jQuery(function($)
    		{
    			var i=1;
    			$('.my_text_box textarea').each(function(e)
    			{
    				var id = $(this).attr('id');
    
    				if (!id)
    				{
    					id = 'my_text_box-' + i++;
    					$(this).attr('id',id);
    				}
    
    				tinyMCE.execCommand('mceAddControl', false, id);
    
    			});
    		});
    	/* ]]> */</script><?php
    }

    But that doesn’t load any tiny_mce onto any of the boxes.
    Any help or ideas?

Viewing 1 replies (of 1 total)
  • Thread Starter lsatdown

    (@lsatdown)

    I;ve noticed that if you change the main editor to ‘HTML’ from ‘Visual’, and refresh the page, the links work fine?!

    So it seems the main editor javascript is affecting the multiple tinymce instances somehow?

Viewing 1 replies (of 1 total)
  • The topic ‘Multiple tiny_mce instances, hyperlink issues’ is closed to new replies.