Răsfoiți Sursa

Fixed issue with spaces in setData view utility.

Szymon Kupś 9 ani în urmă
părinte
comite
e11b8673d6

+ 6 - 0
packages/ckeditor5-engine/tests/_utils-tests/view.js

@@ -317,6 +317,12 @@ describe( 'view test utils', () => {
 			expect( text.data ).to.equal( 'foobar' );
 		} );
 
+		it( 'should parse text with spaces', () => {
+			const text = parse( 'foo bar' );
+			expect( text ).to.be.instanceOf( Text );
+			expect( text.data ).to.equal( 'foo bar' );
+		} );
+
 		it( 'should parse elements and texts', () => {
 			const view = parse( '<b>foobar</b>' );
 			const element = new Element( 'b' );

+ 1 - 1
packages/ckeditor5-engine/tests/_utils/view.js

@@ -331,7 +331,7 @@ class RangeParser {
 
 		if ( node instanceof ViewText ) {
 			const regexp = new RegExp(
-				`[ ${ TEXT_RANGE_START_TOKEN }${ TEXT_RANGE_END_TOKEN }\\${ ELEMENT_RANGE_END_TOKEN }\\${ ELEMENT_RANGE_START_TOKEN } ]`,
+				`[${ TEXT_RANGE_START_TOKEN }${ TEXT_RANGE_END_TOKEN }\\${ ELEMENT_RANGE_END_TOKEN }\\${ ELEMENT_RANGE_START_TOKEN }]`,
 				'g'
 			);
 			let text = node.data;