Im working with a TinyMCE plugin (WordPress 4.7.2), and I’ve noticed that Im getting a method deprecation warning when I create a new modal. However my code example is very similar to Tiny MCE’s own example code. Can anyone shed some light on why this warning is being fired, as I don’t believe, based on their example, that I’m actually using the old syntax.

My full code:

(function () {
   tinymce.create('tinymce.plugins.EXAMPLE', {
    init: function (ed, url) {
        // Register commands
        ed.addCommand('EXAMPLE', function () {

             // DEPRECIATION WARNING THROWN HERE
             ed.windowManager.open({
                 url: ajaxurl + '?action=example_modal', // modal window
                 width: 520 + parseInt(ed.getLang('button.delta_width', 0)), // size of our window
                 height: 620 + parseInt(ed.getLang('button.delta_height', 0)),
                 inline: 1
             }, {
                 plugin_url: url
             });
        });
        // Register buttons
        ed.addButton('EXAMPLE', {
            title: 'Create Modal',
            image: url + '/../app_icon.png',
            cmd: 'EXAMPLE'
        });
    },
    getInfo: function () {
        return {
            longname: 'EXAMPLE',
            author: 'test',
            authorurl: 'test',
            infourl: 'test',
            version: '1.0',
            version: tinymce.majorVersion + '.' + tinymce.minorVersion
           };
       }
   });
   // Register plugin
   // first parameter is the button ID and must match ID elsewhere
   // second parameter must match the first parameter of the tinymce.create() function above
   tinymce.PluginManager.add('EXAMPLE', tinymce.plugins.EXAMPLE);
})();

Tiny MCE’s own example code:

ed.windowManager.open({
   url : this.url + 'file.html?param=' + ed.getParam("pluginName_param_name"),
   width : 640 + parseInt(ed.getLang('amadeo_draft.delta_width', 0)),
   height : 511 + parseInt(ed.getLang('amadeo_draft.delta_height', 0)),
   movable : true,
   inline : true
});

0

Leave a Reply

Your email address will not be published. Required fields are marked *