Sfoglia il codice sorgente

New line in plain text will be always replaced with paragraph.

Mateusz Samsel 6 anni fa
parent
commit
b8929b454d

+ 2 - 3
packages/ckeditor5-clipboard/src/utils/plaintexttohtml.js

@@ -18,9 +18,8 @@ export default function plainTextToHtml( text ) {
 		// Encode <>.
 		// Encode <>.
 		.replace( /</g, '&lt;' )
 		.replace( /</g, '&lt;' )
 		.replace( />/g, '&gt;' )
 		.replace( />/g, '&gt;' )
-		// Creates paragraphs for double line breaks and change single line breaks to <br>s.
-		.replace( /\n\n/g, '</p><p>' )
-		.replace( /\n/g, '<br>' )
+		// Creates paragraphs for every line breaks.
+		.replace( /\n/g, '</p><p>' )
 		// Preserve trailing spaces (only the first and last one – the rest is handled below).
 		// Preserve trailing spaces (only the first and last one – the rest is handled below).
 		.replace( /^\s/, '&nbsp;' )
 		.replace( /^\s/, '&nbsp;' )
 		.replace( /\s$/, '&nbsp;' )
 		.replace( /\s$/, '&nbsp;' )