How to create a plugin for TinyMCE?

jerrac's picture

My college uses a calender system that has some javascript code you can use to insert various calenders into your pages. Fortunately, the code is pretty simple, there's only one value that changes. So I figured it should be easy to create a plugin for TinyMCE that inserts some kind of place holder code into the page. Then I'd used HTML Purifier or a Text Format to output the code with the correct javascript.

So, how do I create a custom module that hooks into WYSIWYG and TinyMCE to do what I want?

I using Drupal 7 and the latest versions of WYSIWYG and TinyMCE.

I have read through the WYSIWYG api file, found http://deglos.com/blog/2010/12/21/building-wysiwyg-plugin-drupal, looked at imce_wysiwyg, and the break plugin. I sort of get some of it, but not really enough to get started. The tutorial code didn't do a thing as far as I can tell, and modifying the stuff from imce_wysiwyg did nothing... Are there any other good resources?

Also, to be clear, what I'm after is just getting to the point of inserting the placeholder code. If I need help with the text filter, I'll find it elsewhere. :)

Well, back to more experimenting.

Comments

Maybe look at this:

sirtet's picture

Not really sure if i understand your question, but
maybe you want to have a look at
http://drupal.org/project/wysiwyg_codemagic
this s a module that adds a TinyMCE-Plugin to WYSIWYG.
I made it by looking at
another module, that adds another plugin.
See it's issue for a D7-Port:
http://drupal.org/node/1127454#comment-4424564

Wysiwyg

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: