Ben
Ben

Reputation: 62474

Trouble getting a reference to TinyMCE editor instance

I'm using the jQuery plugin for TinyMCE and have had a hard time trying to figure out how to reference an instance after it's been initialized. My goal is to remove a menu item.

$(document).ready(function () {
    var el = $('textarea.tinymce').tinymce({
        script_url : '../lib/tiny_mce/tiny_mce.js',
        plugins: "paste,visualchars,customspecialchars,customvariables,customfootnotes",
        theme : "advanced", 
        theme_advanced_buttons1 : "bullist,|,customspecialchars,customvariables,customfootnotes,|,undo,redo,|,cut,copy,paste",
        theme_advanced_buttons2 : "",
        theme_advanced_buttons3 : "",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left"
    });

    console.log(tinyMCE);  //undefined since I'm using jquery plugin
    console.log($(el).tinymce());
    $('input[name^="footnote"]').keyup(function () {
        console.log(editor);
    });
});

That's my init code (note the custom plugins). I can't figure out how to call tinymce.ui.DropMenu.removeAll() on my jquery tinymce instance

Upvotes: 4

Views: 5792

Answers (1)

Thariama
Thariama

Reputation: 50840

This should give you the editor instance:

tinymce.get($(el).attr('id') || 'content');

Upvotes: 2

Related Questions