diff --git a/src/converters.js b/src/converters.js index b728e95..698c123 100644 --- a/src/converters.js +++ b/src/converters.js @@ -66,9 +66,10 @@ export function modelToViewCodeBlockInsertion( model, languageDefs, useLabels = const targetViewPosition = mapper.toViewPosition( model.createPositionBefore( data.item ) ); const preAttributes = {}; - // The attribute added only in the editing view. + // Attributes added only in the editing view. if ( useLabels ) { preAttributes[ 'data-language' ] = languagesToLabels[ codeBlockLanguage ]; + preAttributes.spellcheck = 'false'; } const pre = writer.createContainerElement( 'pre', preAttributes ); diff --git a/tests/codeblockediting.js b/tests/codeblockediting.js index 3ef814f..8a42905 100644 --- a/tests/codeblockediting.js +++ b/tests/codeblockediting.js @@ -575,13 +575,19 @@ describe( 'CodeBlockEditing', () => { it( 'should convert empty codeBlock to empty pre tag', () => { setModelData( model, '' ); - expect( getViewData( view ) ).to.equal( '
[]
' ); + expect( getViewData( view ) ).to.equal( + '
' +
+					'[]' +
+				'
' ); } ); it( 'should convert non-empty codeBlock to pre tag', () => { setModelData( model, 'Foo' ); - expect( getViewData( view ) ).to.equal( '
{}Foo
' ); + expect( getViewData( view ) ).to.equal( + '
' +
+					'{}Foo' +
+				'
' ); } ); it( 'should convert codeBlock with softBreaks to pre tag #1', () => { @@ -594,7 +600,7 @@ describe( 'CodeBlockEditing', () => { ); expect( getViewData( view ) ).to.equal( - '
' +
+				'
' +
 					'{}Foo

Bar

Biz
' + '
' ); } ); @@ -611,7 +617,7 @@ describe( 'CodeBlockEditing', () => { ); expect( getViewData( view ) ).to.equal( - '
' +
+				'
' +
 					'[]



Foo



' + '
' ); } ); @@ -635,7 +641,7 @@ describe( 'CodeBlockEditing', () => { ); expect( getViewData( view ) ).to.equal( - '
' +
+						'
' +
 							'{}foo' +
 						'
' ); @@ -666,7 +672,7 @@ describe( 'CodeBlockEditing', () => { setModelData( model, 'foo' ); expect( getViewData( view ) ).to.equal( - '
' +
+						'
' +
 							'{}foo' +
 						'
' );