WordPress.org

Support

Support » How-To and Troubleshooting » Visual Editor missing after 3.9

Visual Editor missing after 3.9

  • Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

    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?

Viewing 15 replies - 1 through 15 (of 29 total)
  • Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

    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.

    Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

    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?

    Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

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

    Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

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

    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!

    Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

    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.

    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?

    Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

    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;
    	}
    }

    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?

    Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

    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?

    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.

    Moderator Bet Hannon

    @bethannon1

    Support Team Volunteer Wrangler

    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?

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

    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?

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

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘Visual Editor missing after 3.9’ is closed to new replies.
Skip to toolbar