Title: Solved: Patch for js errors / &quot;Insert Title&quot; button
Last modified: August 31, 2016

---

# Solved: Patch for js errors / "Insert Title" button

 *  Resolved [p14nd4](https://wordpress.org/support/users/p14nd4/)
 * (@p14nd4)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/solved-patch-for-js-errors-insert-title-button/)
 * A site I maintain still uses this plugin, and it was recently brought to my attention
   that the “insert title” button in the WP visual editor wasn’t working. Throwing
   a javascript debugger into the mix exposed errors along the lines of “no method‘
   onInit’ for undefined” or “no index ‘window_height’ for undefined”.
 * The issue I discovered boiled down to a few minor changes in the TinyMCE code,
   since this plugin was written against TinyMCE API 3 and WordPress is, at the 
   time of this writing, using TinyMCE API 4. Thankfully, though, a TinyMCE 3 compatibility
   layer is present, significantly easing the transition. (I apologize for taking
   the lazy way out and not taking the time to properly port this to TinyMCE API
   4.)
 * The two scripts in wp-content/plugins/multi-page-toolkit/buttons/js needed to
   be patched as follows:
 *     ```
       --- dialog-20160124-1824-drh-port-tinymce-4.js  2009-04-08 21:53:39.000000000 -0500
       +++ dialog.js   2016-01-24 18:30:00.320786435 -0600
       @@ -23,4 +23,4 @@
               }
        };
   
       -tinyMCEPopup.onInit.add(PageTitleDialog.init, PageTitleDialog);
       +tinyMCEPopup.editor.onInit.add(PageTitleDialog.init, PageTitleDialog);
       ```
   
 * and
 *     ```
       --- tiny_mce_popup.20160124-1700-drh-port-tinymce-4.js  2016-01-24 17:00:00.308056097 -0600
       +++ tiny_mce_popup.js   2016-01-24 18:53:20.791169867 -0600
       @@ -20,7 +20,7 @@
                       tinymce = w.tinymce;
                       tinyMCE = w.tinyMCE;
                       t.editor = tinymce.EditorManager.activeEditor;
       -               t.params = t.editor.windowManager.params;
       +               t.params = t.editor.windowManager.getParams();
   
                       // Setup local DOM
                       t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
       @@ -28,7 +28,7 @@
   
                       // Setup on init listeners
                       t.listeners = [];
       -               t.onInit = {
       +               t.editor.onInit = {
                               add : function(f, s) {
                                       t.listeners.push({func : f, scope : s});
                               }
       ```
   
 * [https://wordpress.org/plugins/multi-page-toolkit/](https://wordpress.org/plugins/multi-page-toolkit/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [p14nd4](https://wordpress.org/support/users/p14nd4/)
 * (@p14nd4)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/solved-patch-for-js-errors-insert-title-button/#post-6983518)
 * I apparently missed the edit window, but wanted to add that I did go back to 
   grab the original error messages, which may help other people find this in the
   future:
 * `Uncaught TypeError: Cannot read property 'mce_inline' of undefined tinyMCEPopup.
   getWindowArg @ tiny_mce_popup.js:47`
 * and
 * `Uncaught TypeError: Cannot read property 'plugin_url' of undefined tinyMCEPopup.
   getWindowArg @ tiny_mce_popup.js:47`
 * I’ve also posted this on [my blog](http://www.p14nd4.com/blog/2016/01/24/multi-page-toolkit-plugin-insert-page-fix/),
   and may respond more quickly there if you have comments or questions.

Viewing 1 replies (of 1 total)

The topic ‘Solved: Patch for js errors / "Insert Title" button’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/multi-page-toolkit.svg)
 * [Multi-page Toolkit](https://wordpress.org/plugins/multi-page-toolkit/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/multi-page-toolkit/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/multi-page-toolkit/)
 * [Active Topics](https://wordpress.org/support/plugin/multi-page-toolkit/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/multi-page-toolkit/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/multi-page-toolkit/reviews/)

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * 1 reply
 * 1 participant
 * Last reply from: [p14nd4](https://wordpress.org/support/users/p14nd4/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/solved-patch-for-js-errors-insert-title-button/#post-6983518)
 * Status: resolved