0

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

1 Answer 1

1

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();
    });
});
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.