Reputation: 5372
I have a jQuery plugin (jQuery.fn.myJQueryPlugin
) that loads on a page that also loads a TinyMCE editor.
Is there a way I can get the plugin to work on the content of the TinyMCE editor (via a TinyMCE plugin)?
I've tried something along the lines of
tinymce.PluginManager.add( 'myTinyMCEPlugin', function( editor ) {
editor.on('PostProcess', function(event){
editor.getWin().parent.jQuery(".trigger-class").myJQueryPlugin();
});
});
but that doesn't seem to work
Upvotes: 0
Views: 299
Reputation: 5372
ok, it turns out, it can be done:
tinymce.PluginManager.add( 'myTinyMCEPlugin', function( editor ) {
editor.on('PostProcess', function(event){
// get jQuery from parent window
$ = editor.getWin().parent.jQuery;
$(".trigger-class", editor.getDoc()).myJQueryPlugin();
});
});
Upvotes: 1