So I found where the problem come from and found a solution:
In wysiwyg.js in the GetOriginalId function on line 54.
The function wants to get the original ID to get tinyMCEPreInit.mceInit
The problem is if you delete the first wysiwig, you only get IDs that looks like "myId_1". So when it wants to compare its value with tinyMCEPreInit.mceInit.hasOwnProperty (which looks for"myId" without The "_1" on line 61. Tt returns false.
Here's an easy solution:
Replace this (line 58 to 66) :
$clones.each( function ()
{
var currentId = $( this ).find( '.rwmb-wysiwyg' ).attr( 'id' );
if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) )
{
id = currentId;
return false; // Immediately stop the .each() loop
}
} );
With :
var substracted_charaters = [0,2,3];
for (let count of substracted_charaters ){
currentId = currentId.substring(0, currentId.length - count);
if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) ) {
return currentId; // Immediately stop the .each() loop
}
}
Tested it and it works.
Instead of looping through each input to find the original ID, we take the first ID we find and get rid of 2 or 3 characters until we find the original ID. Will not work if someone creates more than 100 wysiwyg and deletes them all.
Thank you for the awesome plugin !
Adam Kettani