TinyMCE for jQuery
Spocke Before the summer we added a new jQuery plugin and a special jQuery build for TinyMCE but we haven’t displayed or documented until now. The new jQuery plugin enables you to more easily interact with TinyMCE using the standard jQuery functions. This improves compatibility with other jQuery plugins such as validators and we think this is a must have if you use jQuery and TinyMCE together.
The jQuery plugin also adds a special tinymce function that enables you to initialize editors and get the editor instance by using selectors. This function will also enable you to lazy load the core script when it’s needed this is useful where you have a global script in a CMS or site and you want to load and apply TinyMCE only to specific pages and textareas. The plugin also adds a tinymce pseudo selector so that you can select only the textareas that got converted.
Here is an example of lazy loading TinyMCE only for textareas with a specific tinymce class.
// Initializes all textareas with the tinymce class
$().ready(function() {
$('textarea.tinymce').tinymce({
script_urlĀ : '../js/tinymce/jscripts/tiny_mce/tiny_mce.js',
themeĀ : "advanced",
...
});
});
We also made a special jQuery build of TinyMCE this build excludes the Sizzle engine since it’s already in jQuery so it was redundant to have the same logic added twice it also uses the jQuery versions of some functions but currently only some of the basic ones. Stefan Petre contributed some logic for this jQuery adapter however these patches wasn’t introduced in this first release due to some compatibility issues. Also we don’t want to replace to much logic since it isn’t a major gain in size and it doubles the testing time and possible bugs.
It’s also important to say that we have plans for similar adapters and packages for other common libraries but our time and also our knowledge of these are limited so if someone is willing to help out please let us know. We would also be interested in your feedback regarding the jQuery plugin might be things we should improve.
Another thing that’s important is that TinyMCE will remain library independent so even if we release this special jQuery version the main build still works without jQuery and can be used with any library out there.
You can read more about the specifics of the jQuery plugin at the jQuery plugin reference page in the Wiki. The jQuery version and it’s plugin can be found at the download page.
Posted in Development, Software, Work
Thanks for this great enhancement.
But how does it work with the gzip compressor?
August 17th, 2009 at 15:27[...] internal functions and adding a new tinymce function and tinymce pseudo selector. ” — announcement — download — wiki Spread the [...]
August 17th, 2009 at 15:30Good point. The compressors needs to be updated to support this plugin. They should have been updated anyway since there is a few issues with them that I’ve been meaning to resolve.
August 17th, 2009 at 16:21In the mean time, I remember created 2 issues for moxiecompressor a while agoe: http://code.google.com/p/moxiecompressor/issues/list
August 18th, 2009 at 10:41I was actually interested in JQUERY being used as a plugin for TinyMCE, not the other way around. Sorry for any confusion, that I caused.
August 21st, 2009 at 05:18What should that plugin do? You can use jQuery with TinyMCE all ready.
August 23rd, 2009 at 16:29Are there any updates to the compressor code planned?
Since tinyMCE is not really on the small side, the compressor is essential.
September 8th, 2009 at 13:58Is there any issues with the compressor? The only thing it doesn’t support right now is compression when used with jQuery.
September 8th, 2009 at 19:01