WordPress.org

Ready to get started?Download WordPress

Forums

Visual Editor missing after 3.9 (27 posts)

  1. Bet Hannon
    Member
    Posted 4 months ago #

    Like some others, I have had the visual editor disappear from some sites after updating to 3.9. I've been asked to make a separate post. Here's what I have done & found:

    I did have this problem on a few single-install (regular WP) sites, but discovered that when I deactivated all plugins, then re-activated them, the visual editor reappeared and stayed. I could not identify the plugin which caused the issue, but those sites resolved.

    I'm still having this issue of no visual editor on several sites in a multisite install. There are 55+ sites in the install, but only 10 are affected. Those 10 don't seem to have any common themes or plugins that aren't also on unaffected sites.

    Changing the theme to TwentyThirteen does not make a difference.

    I have tried deactivating both all the site-activated and network activated plugins (thinking my single-site solution would work), but it didn't.

    Adding define('SCRIPT_DEBUG', true);, to wp-config.php did not fix this issue.

    Using this post, http://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors, I am finding this error: TypeError: r is undefined tinymce.min.js:8

    Ideas for what else to try?

  2. Bet Hannon
    Member
    Posted 4 months ago #

    I've checked error logs: nothing to report there (except that NextGEN Smooth Gallery has been having a MySQL syntax error for more than a week that I didn't know about--that plugin is deactivated & did not affect the visual editor issue).

    While I did deactivate all the network activated plugins and the plugins for my affected site at the same time, there would have still been other site-activated plugins active. It would be a HUGE task on 55+ sites to document which sites have which plugins site-activated, deactivate them all (although this could be done via FTP, I guess), then reactivate & restore settings. I'm hoping to avoid that.

  3. Bet Hannon
    Member
    Posted 4 months ago #

    I also looked at this with Chrome, and got this slightly different error message for the same file:

    "Uncaught TypeError: Cannot read property 'documentBaseURL' of undefined tinymce.min.js?ver=4021-20140412:8"

    It looks like there was a similar issue in the development of 3.9 (https://core.trac.wordpress.org/ticket/26750). Any clue what I could try to get my visual editors back?

    Ipstenu replied here (http://wordpress.org/support/topic/39-visual-editor?replies=19) that my fix on the single-install sites sounded like the sites needed to have jquery forcibly reloaded. How would I do that on a multisite with 55+ sites?

  4. Bet Hannon
    Member
    Posted 4 months ago #

    Also, since "define('SCRIPT_DEBUG', true);" didn't solve my issue, should I now take it out of wp-config.php?

  5. Bet Hannon
    Member
    Posted 4 months ago #

    Maybe this image of the full error message will help:
    http://easycaptures.com/3396243282

  6. finaldesign
    Member
    Posted 4 months ago #

    Hi Bet!
    I had just resolved the same problem with visual editor on one of my sites. I have managed to replicate it in my local XAMPP installation as on live linux production server.
    The problem was with the plugin "navis media credit", used in LargoProject theme. If you try to disable that plugin it will stay activated anyway and your visual editor wont work. If you switch to another theme visual editor is still not working. Only when you mannualy delete plugin via FTP from server it get's deactivated, and visual editor then works fine.

    I hope that helps,
    regards!

  7. Bet Hannon
    Member
    Posted 4 months ago #

    Hi finaldesign! Thanks for replying.

    I am not using that particular plugin.

    I have 10 sites in my multisite install that are affected, and I've been through the lists of plugins that each are using, and there is no plugin that is common only to these affected sites. They are using some of the same plugins, but those plugins are also being used on non-affected sites.

  8. Leaving the script debug won't hurt anything.

    ps_editor.js is actually the one that jumped out at me, because it's NOT a part of core! Can you search the files in your site for that one?

  9. Bet Hannon
    Member
    Posted 4 months ago #

    Hi Mika! Thanks for replying!

    That plugin is PS Disable Auto Formatting, which was network activated. I deactivated it, but that didn't make the visual editor appear, nor did deleting the plugin (even after deleting the browser cache-- not using caching plugins). I'm also still getting the js error message-- the same one in the image-- still including ps_editor.js!

    Below is the content of the file that is referenced (ps_editor.js), the lines the error references are 7 & 39. Maybe that will help?

    var switchEditors = {
    
    	switchto: function(el) {
    		var aid = el.id, l = aid.length, id = aid.substr(0, l - 5), mode = aid.substr(l - 4);
    
    		this.go(id, mode);
    	},
    
    	go: function(id, mode) { // mode can be 'html', 'tmce', or 'toggle'
    		id = id || 'content';
    		mode = mode || 'toggle';
    
    		var t = this, ed = tinyMCE.get(id), wrap_id, txtarea_el, dom = tinymce.DOM;
    
    		wrap_id = 'wp-'+id+'-wrap';
    		txtarea_el = dom.get(id);
    
    		if ( 'toggle' == mode ) {
    			if ( ed && !ed.isHidden() )
    				mode = 'html';
    			else
    				mode = 'tmce';
    		}
    
    		if ( 'tmce' == mode || 'tinymce' == mode ) {
    			if ( ed && ! ed.isHidden() )
    				return false;
    
    			if ( typeof(QTags) != 'undefined' )
    				QTags.closeAllTags(id);
    
    			if ( tinyMCEPreInit.mceInit[id] && tinyMCEPreInit.mceInit[id].wpautop )
    				txtarea_el.value = t.wpautop( txtarea_el.value );
    
    			if ( ed ) {
    				ed.show();
    			} else {
    				ed = new tinymce.Editor(id, tinyMCEPreInit.mceInit[id]);
    				ed.render();
    			}
    
    			dom.removeClass(wrap_id, 'html-active');
    			dom.addClass(wrap_id, 'tmce-active');
    			setUserSetting('editor', 'tinymce');
    
    		} else if ( 'html' == mode ) {
    
    			if ( ed && ed.isHidden() )
    				return false;
    
    			if ( ed ) {
    				txtarea_el.style.height = ed.getContentAreaContainer().offsetHeight + 20 + 'px';
    				ed.hide();
    			}
    
    			dom.removeClass(wrap_id, 'tmce-active');
    			dom.addClass(wrap_id, 'html-active');
    			setUserSetting('editor', 'html');
    		}
    		return false;
    	},
    
    	_wp_Nop : function(content) {
    		var blocklist1, blocklist2;
    
    		// Protect pre|script tags
    		if ( content.indexOf('<pre') != -1 || content.indexOf('<script') != -1 ) {
    			content = content.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
    				a = a.replace(/<br ?\/?>(\r\n|\n)?/g, '<wp_temp>');
    				return a.replace(/<\/?p( [^>]*)?>(\r\n|\n)?/g, '<wp_temp>');
    			});
    		}
    
    		// Pretty it up for the source editor
    		var blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tr|th|td|div|h[1-6]|p';
    		content = content.replace(new RegExp('\\s*</('+blocklist1+')>\\s*', 'mg'), '</$1>\n');
    		content = content.replace(new RegExp('\\s*<(('+blocklist1+')[^>]*)>', 'mg'), '\n<$1>');
    
    		content = content.replace(new RegExp('<p( [^>]*)?>[\\s\\n]*<(/?script[^>]*)>', 'mg'), '\n<$2>');
    		content = content.replace(new RegExp('<(/?script[^>]*)>[\\s\\n]*</p>', 'mg'), '\n<$1>');
    
    		// Fix some block element newline issues
    		content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
    		content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
    		content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
    		content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
    
    		var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
    		content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
    		content = content.replace(new RegExp('\\s*</('+blocklist2+')>\\s*', 'mg'), '</$1>\n');
    		content = content.replace(new RegExp('<li([^>]*)>', 'g'), '\t<li$1>');
    
    		if ( content.indexOf('<object') != -1 ) {
    			content = content.replace(new RegExp('\\s*<param([^>]*)>\\s*', 'mg'), "<param$1>");
    			content = content.replace(new RegExp('\\s*</embed>\\s*', 'mg'), '</embed>');
    		}
    
    		// Unmark special paragraph closing tags
    		content = content.replace(new RegExp('</p#>', 'g'), '</p>\n');
    		content = content.replace(new RegExp('\\s*(<p [^>]+>.*</p>)', 'mg'), '\n$1');
    		content = content.replace(new RegExp('<p>\\s*</p>', 'mg'), "<p>&nbsp;</p>\n");
    
    		// put back the line breaks in pre|script
    		content = content.replace(/<wp_temp>/g, '\n');
    
    		return content;
    	},
    
    	_wp_Autop : function(pee) {
    		// filtered when switching html to visual
    		var blocklist = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|script';
    		var blocklist2 = 'table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|h[1-6]|script';
    		pee = pee + "\n\n";
    		pee = pee.replace(new RegExp('(<(?:'+blocklist+')[^>]*>)', 'gi'), "\n$1");
    		pee = pee.replace(new RegExp('(</(?:'+blocklist+')>)', 'gi'), "$1\n\n");
    		pee = pee.replace(new RegExp("\\r\\n|\\r", 'g'), "\n");
    		pee = pee.replace(new RegExp("\\n\\s*\\n+", 'g'), "\n\n");
    		pee = pee.replace(new RegExp('([\\s\\S]+?)\\n\\n', 'mg'), "<p>$1</p>\n");
    		pee = pee.replace(new RegExp('<p( [^>]*)?>[\\s\\n]*</p>', 'mg'), "<p$1>&nbsp;</p>\n");
    		pee = pee.replace(new RegExp('<p>\\s*(</?(?:'+blocklist+')[^>]*>)\\s*</p>', 'gi'), "$1");
    		pee = pee.replace(new RegExp("<p>(<li.+?)</p>", 'gi'), "$1");
    		pee = pee.replace(new RegExp("<p ?[^>]*>(<!--(.*)?-->)", 'gi'), "$1");
    		pee = pee.replace(new RegExp("(<!--(.*)?-->)</p>", 'gi'), "$1");
    		pee = pee.replace(new RegExp('<p>\\s*<blockquote([^>]*)>', 'gi'), "<blockquote$1><p>");
    		pee = pee.replace(new RegExp('</blockquote>\\s*</p>', 'gi'), '</p></blockquote>');
    		pee = pee.replace(new RegExp('<p>[\\s\\n]*(<(?:'+blocklist+')[^>]*>)', 'gi'), "$1");
    		pee = pee.replace(new RegExp('<p>[\\s\\n]*(</(?:'+blocklist2+')[^>]*>)', 'gi'), "$1");
    		pee = pee.replace(new RegExp('(<(?:'+blocklist2+')[^>]*>)[\\s\\n]*</p>', 'gi'), "$1");
    		pee = pee.replace(new RegExp('(</(?:'+blocklist+')[^>]*>)[\\s\\n]*</p>', 'gi'), "$1");
    		pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
    		pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
    		pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
    
    		// Fix the pre|script tags
    		pee = pee.replace(/<(pre|script)[^>]*>[\s\S]+?<\/\1>/g, function(a) {
    			a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
    			return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
    		});
    
    		return pee;
    	},
    
    	pre_wpautop : function(content) {
    		var t = this, o = { o: t, data: content, unfiltered: content },
    			q = typeof(jQuery) != 'undefined';
    
    		if ( q )
    			jQuery('body').trigger('beforePreWpautop', [o]);
    		o.data = t._wp_Nop(o.data);
    		if ( q )
    			jQuery('body').trigger('afterPreWpautop', [o]);
    
    		return o.data;
    	},
    
    	wpautop : function(pee) {
    		var t = this, o = { o: t, data: pee, unfiltered: pee },
    			q = typeof(jQuery) != 'undefined';
    
    		if ( q )
    			jQuery('body').trigger('beforeWpautop', [o]);
    		o.data = t._wp_Autop(o.data);
    		if ( q )
    			jQuery('body').trigger('afterWpautop', [o]);
    
    		return o.data;
    	}
    }
  10. I'm also still getting the js error message-- the same one in the image-- still including ps_editor.js!

    Hmmm. Do you have any server side caching going on, like memcached?

  11. Bet Hannon
    Member
    Posted 4 months ago #

    Not that I know of. I'm on Mediatemple's gs server. Should I be able to tell if they have some server caching going on?

  12. Maybe... Can you restart apache on that server? Ask MT to do it, I think it's overkill but it should force clear the cache.

  13. Bet Hannon
    Member
    Posted 4 months ago #

    MediaTemple says they run Varnish on their GRID server. They tell me because it is a shared server, they can't reset Varnish, or restart Apache.

    Other ideas?

  14. finaldesign
    Member
    Posted 4 months ago #

    Im sure its a plugin issue or maybe template functions file is customized?

  15. smrtcookie83
    Member
    Posted 4 months ago #

    I'm not sure if I'm posting this in the right place, but I updated to 3.9 yesterday and I can't even write a post, let alone add media anymore. I use the Genesis framework and a theme I purchased called "Foodie". I tried deactivating my plugins and that didn't work. Any ideas?

  16. bemdesign
    Member
    Posted 4 months ago #

    @smrtcookie83 - Per the forum guidelines (you did read them right? :-) ), please post your issue as a new post in the support forums.

  17. Bet Hannon
    Member
    Posted 4 months ago #

    @smrtcookie83, start by trying this: http://codex.wordpress.org/Using_Your_Browser_to_Diagnose_JavaScript_Errors, (although the instructions here are for older versions of these browsers, and you may need to google more updated instructions, like I did).

  18. Bet Hannon
    Member
    Posted 4 months ago #

    The mystery deepens:

    My quick look through the multisite shows that only 10 of 555+ sites are affected. Last night, I got an email from a client on one of the UNaffected sites, telling me he can't switch into Visual editor. He describes the problem I am having exactly.

    So I thought initially maybe caching had led me to believe that there were unaffected sites at all-- since really, doesn't it make more sense for multisite subsites to ALL be affected by a TinyMCE issue?

    But I can't replicate the issue on the client's site. It remains unaffected for me. The client is a pretty tech savvy guy, so I'll ask him to look for js errors.

  19. Bet Hannon
    Member
    Posted 4 months ago #

    My visual editors are back up! Yaay!

    Maybe there was some caching that wasn't emptying before – no clue.

    Based on the fact that the plug-in was working on a majority of my other sites, I reinstalled and activated PS Disable Auto Formatting, and the visual editors stayed working.

    On another post, when I commented that disabling all plug-ins and re-enabling them made the issue go away, Ipstenu commented that perhaps the JavaScript needed to be forced into refreshing. Whatever did it, I'm just happy to have everything back! :-)

    Thanks to all the great support forum folks were patiently answering all of our questions when these updates turn our sites upside down!

  20. Bet Hannon
    Member
    Posted 4 months ago #

    Just a followup, in case it can be helpful for someone else:

    I discovered that the plugin PS Disable Auto Formatting, while it had been network activated, must have at some point, been single site activated on a handful of sites before the network activation. These sites were curiously not among the affected sites, but somehow that seemed to be the source of my js errors.

    I used Network Plugin Auditor to be able to see that some sites had the plugin still activated (even after changing the directory name via ftp--so maybe that's a multisite peculiarity?). Then, I used Multisite Plugin Manager to mass deactivate the plugin on those sites.

    That cleared up my problem, and I was then able to network reactivate the plugin with no more issues.

  21. ronzastovnik
    Member
    Posted 4 months ago #

    Hi Bet,
    Yep, PS Disable Auto Formatting was it. I had the same problem and disabled the plugin then re-activated it. My Visual Editor tab is working now, so far. Hope it doesn't happen again. Maybe they'll release an update. Thanks for the posts.

  22. Bet Hannon
    Member
    Posted 4 months ago #

    Unfortunately, I have a multisite subsite client still reporting not being able to access the visual editor, so it looks like just deactivating & reactivating didn't completely do it. :-(

    I'm trying out this plugin with a similar function (which happily seems like it is being more actively supported): Disable Automatic P Tags.

  23. ronzastovnik
    Member
    Posted 4 months ago #

    It acts like the Text tab "sticks". I was editing fine until I went to the Text mode, did some editing there and updated my page. Then I couldn't go back to the Visual mode. Had to deactivate the PS Disable plug-in, then go to the editor, click the Visual tab, then go back and activate PS Disable.

    Just de-activating and re-activating the PS Disable didn't do it. Had to open the editor and click the Visual tab in between.

    Looks to me like PS Disable plug-in needs an update, but I see that plug-in hasn't been updated in 2 years. Looks like time for a replacement.

  24. Bet Hannon
    Member
    Posted 4 months ago #

    Just a followup fyi: the plugin author released an update today to make it compatible with 3.9!
    https://wordpress.org/plugins/ps-disable-auto-formatting/

  25. Michael
    Member
    Posted 4 months ago #

    Yep, that was it. My site was showing the same problem, Bet, and the update to the new PS Disable Auto Formatting solved my problem.

    Thanks for posting on this and the level of detail you provided, it helped me solve the problem quickly (and saved me from digging deep into the plugin code).

    Cheers.
    Michael

  26. rayds
    Member
    Posted 4 months ago #

    After the trial & error of deactivating than reactivating each plugin, Visual Editor returned after deactivating Free Stock Photos Foter by Innovaweb Sp. z o.o. plugin.

  27. Aunty Ann
    Member
    Posted 3 months ago #

    Thank you so much for that advice rayds. I was going crazy trying to find the missing visual editor.
    I had purchased a Free Stock Photos plugin called Image Pressr and, as I had paid for it I obviously wanted to use it!
    But once I had deactivated it - having stored the image I want in the media library - the visual editor came back!
    Thanks so much. You have saved me hours of frustration! It is now gone midnight so I can finally go to bed and stop worrying about it!

Reply

You must log in to post.

About this Topic