0

After updating from 3.7.1 to 3.9.1 I am seeing issues with the editor within WordPress. In the environment that I have not upgraded, I am able to add content blocks and edit the block type flawlessly. I have disabled all plugins and still see the issue.

In 3.9.1, I see this error on page load:

Deprecated TinyMCE API call: <target>.onInit.add(..)

After clicking +Add Content Block:

TypeError: r is undefined (/wp-includes/js/tinymce/wp-tinymce.php?c=1&ver=4021-20140423)

After selecting the block type:

TypeError: tinyMCE.get(...) is null

I assume the issue is derived from this:

tinymce.create('tinymce.plugins.editor_toolkit', {
    init : function(ed, url) {
        var VK = {
            DELETE: 46, BACKSPACE: 8, ENTER: 13, TAB: 9, SPACEBAR: 32, UP: 38, DOWN: 40, LEFT: 37, RIGHT: 39,
            modifierPressed: function (e) {
                return e.shiftKey || e.ctrlKey || e.altKey;
            }
        };
        function scrollToThisNode(node, padding) {
            vp = ed.dom.getViewPort( ed.getWin() )
            y = ed.dom.getPos(node).y;
            if (y < vp.y || y + padding > vp.y + vp.h) {
                ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + padding);
            }
        }
        ed.onInit.add(function(ed) {
            ed.dom.addClass(ed.getBody(), 'editor-toolkit');

            // Last-ditch effort to structure content
            $('#post').submit(function(){
                $( ed.getBody() ).children('p').each(function(){
                    $(this).replaceWith('<div><p>' + $(this).html() + '</p></div>');
                });
                return true;
            });

        });
3
  • The TinyMCE editor was updated to 4.0 in WordPress 3.9. Try clearing your browser cache. :) Aug 14, 2014 at 19:51
  • Well that would explain it. The tinyMCE is hardcoded in by a previous developer. It must not like the script I added above. I did clear cache - same issue. Aug 14, 2014 at 20:05
  • I did manage to fix the deprecated calls. I now see an error: TypeError: r is undefined Aug 15, 2014 at 12:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.