[wp-testers] CSS in WYSIWYG

Darrell Schulte d at schulte.mn
Fri Dec 16 14:41:33 GMT 2005


On Dec 16, 2005, at 8:00 AM, Owen Winkler wrote:
>
> You don't need to learn javascript to use this, much less the  
> cryptic format of the TinyMCE javascript plugins.  It's also  
> instantly compatible with *both* editors.
>
> I'm interested in comments or updates.
>
> http://redalt.com/downloads/wp2/buttonsnap.zip

Nice Owen. I can see folks liking this a bunch. For the fun of it, I  
tried setting up a button for SimpleTags (http://www.broobles.com/ 
scripts/simpletags/) tagging method (just "tag" not "tags") using the  
following:

add_action('init', 'my_tag_init');

function my_tag_init()
{
	// Set up some unique button image URLs for the new buttons from the  
plugin directory
	$button_image_url1 = buttonsnap_dirname() . '/brick.gif';
	$button_image_url2 = buttonsnap_dirname() . '/brick_add.gif';
	$button_image_url3 = buttonsnap_dirname() . '/brick_delete.gif';

	// Create a vertical separator in the WYSI toolbar (does nothing in  
the Quicktags):
	buttonsnap_separator();
	
	// Create a button that uses Ajax to fetch replacement text from a  
WordPress plugin hook sink:
	buttonsnap_ajaxbutton($button_image_url3, 'Ajax Button', 'my_hook');
	add_filter('my_hook', 'my_tag_sink');
}

function my_tag_sink($selectedtext)
{
	return '<tag>' . $selectedtext . '</tag>';
}

Sad thing is that the tag gets stripped out. I know it works because  
if I replace <tag></tag> with <strong></strong>, the button works and  
the selected text goes bold.

I added "tag" to $valid_elements in /wp-includes/js/tinymce/ 
tiny_mce_gzip.php and for good measure in $allowedposttags of /wp- 
includes/kses.php, but it still strips it out...prior to the  
relocation of of $valid_elements to tiny_mce_gzip.php, I could get it  
to ignore the "tag." I must be overlooking something -- little help?

Again, I can see buttonsnap being helpful for many. Thanks!



Darrell
http://schulte.mn




More information about the wp-testers mailing list