tinymce.WPWindowManager is deprecated. How to use the default editor.windowManager instead in TinyMCE 4 and WordPress 3.9? tinymce.WPWindowManager is deprecated. How to use the default editor.windowManager instead in TinyMCE 4 and WordPress 3.9? wordpress wordpress

tinymce.WPWindowManager is deprecated. How to use the default editor.windowManager instead in TinyMCE 4 and WordPress 3.9?


I had the same problem. The TinyMCE docs are unhelpful, ditto the WordPress docs. I had to go pretty deep into the TinyMCE code to figure out how to get my simple custom popup working again.

Answer

Use the html key to define your html in the object you pass to windowManager.open. Below, I'm using jQuery to select some html that I've placed on the page by hooking into the WordPress after_wp_tiny_mce action.

tinymce.activeEditor.windowManager.open({    title: ed.getLang('mm_tiny_mce.element_attributes'),    width : 300,    height : 300,    html :        '<div id="mm-attrs-pop" class="mm-tinymce-popup" tabindex="-1">' +            jQuery('#mm-attrs-pop-tpl').html() +        '</div>',    buttons: [        {            text: 'Cancel',            onclick: 'close'        },        {            text: 'Set Attributes',            onclick: function(){                //some code here that modifies the selected node in TinyMCE                tinymce.activeEditor.windowManager.close();            }        }    ]});

The relevant TinyMCE code is in classes/ui/Window.js, in particular the renderHTML property. https://github.com/tinymce/tinymce/blob/master/js/tinymce/classes/ui/Window.js

Hope that helps. Cheers, Chris