diff --git a/js/tinymce4/media-credit-tinymce-switch.js b/js/tinymce4/media-credit-tinymce-switch.js
index 5a2d68cc..2abef8f5 100644
--- a/js/tinymce4/media-credit-tinymce-switch.js
+++ b/js/tinymce4/media-credit-tinymce-switch.js
@@ -1,7 +1,7 @@
/*
* Extend editor formatting when switching between HTML and Visual mode.
*
- * Based on /wp-admin/js/editor.js
+ * Based on revision 33771 of /wp-admin/js/editor.js (removep)
*
*/
@@ -10,98 +10,102 @@
$(function () {
- window.switchEditors._wp_Nop = function( content ) {
- var blocklist1, blocklist2,
- preserve_linebreaks = false,
- preserve_br = false;
-
- // Protect pre|script tags
- if ( content.indexOf( '
]*>[\s\S]+?<\/\1>/g, function( a ) {
- a = a.replace( /
(\r\n|\n)?/g, '' );
- a = a.replace( /<\/?p( [^>]*)?>(\r\n|\n)?/g, '' );
- return a.replace( /\r?\n/g, '' );
- });
- }
-
- // keep
tags inside captions and remove line breaks
- if ( content.indexOf( '[caption' ) !== -1 ) {
- preserve_br = true;
- content = content.replace( /\[caption[\s\S]+?\[\/caption\]/g, function( a ) {
- return a.replace( /
]*)>/g, '' ).replace( /[\r\n\t]+/, '' );
- });
- }
-
- // Pretty it up for the source editor
- blocklist1 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|div|h[1-6]|p|fieldset';
- content = content.replace( new RegExp( '\\s*(' + blocklist1 + ')>\\s*', 'g' ), '$1>\n' );
- content = content.replace( new RegExp( '\\s*<((?:' + blocklist1 + ')(?: [^>]*)?)>', 'g' ), '\n<$1>' );
-
- // Mark if it has any attributes.
- content = content.replace( /(]+>.*?)<\/p>/g, '$1
' );
-
- // Separate containing
- content = content.replace( /
]*)?>\s*
/gi, '
\n\n' );
-
- // Remove
and
- content = content.replace( /\s*
/gi, '' );
- content = content.replace( /\s*<\/p>\s*/gi, '\n\n' );
- content = content.replace( /\n[\s\u00a0]+\n/g, '\n\n' );
- content = content.replace( /\s*
\s*/gi, '\n' );
-
- // Fix some block element newline issues
- content = content.replace( /\s*
\s*/g, '
\n' );
- content = content.replace( /\s*\[caption([^\[]+)\[\/caption\]\s*/gi, '\n\n[caption$1[/caption]\n\n' );
- content = content.replace( /caption\]\n\n+\[caption/g, 'caption]\n\n[caption' );
-
- // BEGIN MODIFICATION
- // Also handle media-credit shortcode
- content = content.replace( /\s*\[media-credit([^\[]+)\[\/media-credit\]\s*/gi, '\n\n[media-credit$1[/media-credit]\n\n' );
- content = content.replace( /\[\/media-credit\]\n\n([^\[]*)\[\/caption\]/gi, '[/media-credit] $1[/caption]' ); // remove extra newlines for nested media-credit
- content = content.replace( /\s*\[caption([^\[]+)\[media-credit([^\[]+)\[\/media-credit\]([^\[]*)\[\/caption\]\s*/gi, '\n\n[caption$1[media-credit$2[/media-credit]$3[/caption]\n\n' );
- // END MODIFICATION
-
- blocklist2 = 'blockquote|ul|ol|li|table|thead|tbody|tfoot|tr|th|td|h[1-6]|pre|fieldset';
- content = content.replace( new RegExp('\\s*<((?:' + blocklist2 + ')(?: [^>]*)?)\\s*>', 'g' ), '\n<$1>' );
- content = content.replace( new RegExp('\\s*(' + blocklist2 + ')>\\s*', 'g' ), '$1>\n' );
- content = content.replace( /
]*)>/g, '\t' );
-
- if ( content.indexOf( '