• It would be awesome if there was a checkbox to enable TinyMCE support on textareas. Sometimes I need it, sometimes I don’t, but it would be very helpful if there were an easy way to do it.

    Thanks for the great plugin!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter eldeuce

    (@eldeuce)

    So, I worked in a “hack” for your plugin that works for me for now.

    I have to edit the file that builds the textarea and added an ID to it that is the same as the name. From there, in your JS file I added.

    $("#text_area_id").addClass("mceEditor");
    if ( typeof( tinyMCE ) == "object" && typeof( tinyMCE.execCommand ) == "function" ) {
    tinyMCE.execCommand("mceAddControl", false, "text_area_id");
    }

    This gives me the TinyMCE editor on the one textarea I needed it on. Hopefully this will help you integrate this option for future usage!

    Thanks again!

    Thanks for sharing your thoughts. I helped me.

    However, as I have more than one textarea, the JS will only catch the first one and obviously omit the other textareas which have the same IDs.

    Is there a way to execute the tinyMCE.execCommand on classes instead of IDs?

    @caratage
    The answer is here: https://farinspace.com/multiple-wordpress-wysiwyg-visual-editors/

    var i=1;
     $('.verve_meta_box_content textarea').each(function(e)
     {
      var id = $(this).attr('id');
      if (!id)
      {
       id = 'customEditor-' + i++;
       $(this).attr('id',id);
      }
      tinyMCE.execCommand('mceAddControl', false, id);
     });
    creativepickle

    (@creativepickle)

    @joetheboss

    Can you be a bit more specific about where exactly to add that code? Looks like just what I need, but can’t seem to make it work…

    Thanks!

    creativepickle just type this code on to your functions.php,

    thanks to @joetheboss and the information here: https://farinspace.com/multiple-wordpress-wysiwyg-visual-editors/

    // 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;
    			 $('.verve_meta_box_content textarea').each(function(e)
    			 {
    			  var id = $(this).attr('id');
    			  if (!id)
    			  {
    			   id = 'customEditor-' + i++;
    			   $(this).attr('id',id);
    			  }
    			  tinyMCE.execCommand('mceAddControl', false, id);
    			 });
    		});
    	/* ]]> */</script><?php
    }

    Brilliant! Thanks a ton for this. So helpful.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Verve Meta Boxes] TInyMCE Support on Textarea’ is closed to new replies.