Advertisement
helgatheviki

WP Alchemy Repeatable TinyMCE

Feb 10th, 2012
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.58 KB | None | 0 0
  1. jQuery(document).ready(function($) {
  2.     /**
  3.     * Meta: TinyMCE
  4.     */
  5.     function RunTinyMCE() {
  6.         $('.customEditor textarea').each(function(i) {
  7.         //Apply TinyMCE to everyone except the one to copy
  8.             if(!$(this).parents('div.wpa_group').hasClass('tocopy')) {
  9.                
  10.                 var id = $(this).attr('id');
  11.                 if (!id) {
  12.                     id = 'customEditor-' + i;
  13.                     $(this).attr('id', id);
  14.                 }  
  15.                 tinyMCE.execCommand('mceAddControl', false, id);
  16.             }  
  17.         });
  18.     }
  19.  
  20.     RunTinyMCE(); //run onload
  21.    
  22.     $.wpalchemy.bind('wpa_copy', function(the_clone) { //run when copy is made
  23.         RunTinyMCE();
  24.     });
  25.  
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement