8
0
فهرست منبع

Changed new line character to <br> for the editing pipeline.

Oskar Wróbel 6 سال پیش
والد
کامیت
b96c72b9b3

+ 2 - 3
packages/ckeditor5-code-block/src/codeblockediting.js

@@ -61,10 +61,9 @@ export default class CodeBlockEditing extends Plugin {
 		} );
 
 		// Conversion.
-		editor.editing.downcastDispatcher.on( 'insert:codeBlock', modelViewCodeBlockInsertion( editor.model ), { priority: 'high' } );
-		editor.editing.downcastDispatcher.on( 'insert:softBreak', modelViewSoftBreakInsertion( editor.model ), { priority: 'high' } );
+		editor.editing.downcastDispatcher.on( 'insert:codeBlock', modelViewCodeBlockInsertion( editor.model ) );
 
-		editor.data.downcastDispatcher.on( 'insert:codeBlock', modelViewCodeBlockInsertion( editor.model ), { priority: 'high' } );
+		editor.data.downcastDispatcher.on( 'insert:codeBlock', modelViewCodeBlockInsertion( editor.model ) );
 		editor.data.downcastDispatcher.on( 'insert:softBreak', modelViewSoftBreakInsertion( editor.model ), { priority: 'high' } );
 
 		editor.data.upcastDispatcher.on( 'element:pre', dataViewModelCodeBlockInsertion( editor.data ) );

+ 2 - 2
packages/ckeditor5-code-block/tests/codeblockediting.js

@@ -129,7 +129,7 @@ describe( 'CodeBlockEditing', () => {
 				'</codeBlock>'
 			);
 
-			expect( getViewData( view ) ).to.equal( '<pre><code>{}Foo\nBar\nBiz</code></pre>' );
+			expect( getViewData( view ) ).to.equal( '<pre><code>{}Foo<br></br>Bar<br></br>Biz</code></pre>' );
 		} );
 
 		it( 'should convert codeBlock with softBreaks to pre tag #2', () => {
@@ -143,7 +143,7 @@ describe( 'CodeBlockEditing', () => {
 				'</codeBlock>'
 			);
 
-			expect( getViewData( view ) ).to.equal( '<pre><code>{}\n\nFoo\n\n</code></pre>' );
+			expect( getViewData( view ) ).to.equal( '<pre><code>[]<br></br><br></br>Foo<br></br><br></br></code></pre>' );
 		} );
 	} );