web/wp-includes/js/tinymce/plugins/paste/editor_plugin_src.js
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
    21 			paste_remove_styles_if_webkit : true,
    21 			paste_remove_styles_if_webkit : true,
    22 			paste_convert_middot_lists : true,
    22 			paste_convert_middot_lists : true,
    23 			paste_convert_headers_to_strong : false,
    23 			paste_convert_headers_to_strong : false,
    24 			paste_dialog_width : "450",
    24 			paste_dialog_width : "450",
    25 			paste_dialog_height : "400",
    25 			paste_dialog_height : "400",
       
    26 			paste_max_consecutive_linebreaks: 2,
    26 			paste_text_use_dialog : false,
    27 			paste_text_use_dialog : false,
    27 			paste_text_sticky : false,
    28 			paste_text_sticky : false,
    28 			paste_text_sticky_default : false,
    29 			paste_text_sticky_default : false,
    29 			paste_text_notifyalways : false,
    30 			paste_text_notifyalways : false,
    30 			paste_text_linebreaktype : "combined",
    31 			paste_text_linebreaktype : "combined",
   357 			if (ed.settings.paste_enable_default_filters == false) {
   358 			if (ed.settings.paste_enable_default_filters == false) {
   358 				return;
   359 				return;
   359 			}
   360 			}
   360 
   361 
   361 			// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
   362 			// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
   362 			if (tinymce.isIE && document.documentMode >= 9) {
   363 			if (tinymce.isIE && document.documentMode >= 9 && /<(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)/.test(o.content)) {
   363 				// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
   364 				// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
   364 				process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);
   365 				process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);
   365 
   366 
   366 				// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
   367 				// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
   367 				process([
   368 				process([
   788 					[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"],		// Block tags get a blank line after them
   789 					[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"],		// Block tags get a blank line after them
   789 					[/<br[^>]*>|<\/tr>/gi, "\n"],				// Single linebreak for <br /> tags and table rows
   790 					[/<br[^>]*>|<\/tr>/gi, "\n"],				// Single linebreak for <br /> tags and table rows
   790 					[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"],		// Table cells get tabs betweem them
   791 					[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"],		// Table cells get tabs betweem them
   791 					/<[a-z!\/?][^>]*>/gi,						// Delete all remaining tags
   792 					/<[a-z!\/?][^>]*>/gi,						// Delete all remaining tags
   792 					[/&nbsp;/gi, " "],							// Convert non-break spaces to regular spaces (remember, *plain text*)
   793 					[/&nbsp;/gi, " "],							// Convert non-break spaces to regular spaces (remember, *plain text*)
   793 					[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"],// Cool little RegExp deletes whitespace around linebreak chars.
   794 					[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"] // Cool little RegExp deletes whitespace around linebreak chars.
   794 					[/\n{3,}/g, "\n\n"]							// Max. 2 consecutive linebreaks
       
   795 				]);
   795 				]);
       
   796 
       
   797 				var maxLinebreaks = Number(getParam(ed, "paste_max_consecutive_linebreaks"));
       
   798 				if (maxLinebreaks > -1) {
       
   799 					var maxLinebreaksRegex = new RegExp("\n{" + (maxLinebreaks + 1) + ",}", "g");
       
   800 					var linebreakReplacement = "";
       
   801 
       
   802 					while (linebreakReplacement.length < maxLinebreaks) {
       
   803 						linebreakReplacement += "\n";
       
   804 					}
       
   805 
       
   806 					process([
       
   807 						[maxLinebreaksRegex, linebreakReplacement] // Limit max consecutive linebreaks
       
   808 					]);
       
   809 				}
   796 
   810 
   797 				content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));
   811 				content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));
   798 
   812 
   799 				// Perform default or custom replacements
   813 				// Perform default or custom replacements
   800 				if (is(rl, "array")) {
   814 				if (is(rl, "array")) {