- Code: Select all
function tinymce_plugin_cleanup_callback( type, value )
{
switch( type )
{
case 'insert_to_editor' : // called when textarea converted to tiny
case 'insert_image_tags' : // called when inserting image from fileman
direction =
value = value.replace( /<span( class=\"imgwrap[^>]+>)(.+?<\/span>)<\/span>/g, '<table border="1" align="right"$1<tr><td>$2</td></tr></table>' );
break;
case 'get_from_editor' : // called on preview/save pressed
value = value.replace( /<table([^>]+imgwrap[^>]+>).+?<td>(.+?)<\/td>.+?<\/table>/g, '<span$1$2</span>' );
value = value.replace( / border="1" align="right"/g, '' );
break;
}
return value;
}
I think the whole idea behind "imgwrap" doesn't matter. I think it can go away. I'm not sure what the "center" does either, meaning I don't think it actually does anything. Anyway what I have no idea how to do is tweak that regex to find which way the span was floating and use that in place of where I'm forcing the table to align right. Something about writing regexes makes my head explode. Having said that, it seems to me if we can extract out which direction each image is floating then we can use that where I'm forcing the table align to be "right", and if we can do that then I think this issue is completely resolved. A span for an image with or without a caption that looks like a properly floated table if you're using TinyMCE.
Oh and I did not commit this change to the server. I did commit to having no 'close' button, and might commit this, but I am going to see if the imgwrap actually does anything or if it can go byebye.

