Ver código fonte

Differ refresh should not be converter on newly inserted items.

Maciej Gołaszewski 5 anos atrás
pai
commit
6c707fff44

+ 2 - 2
packages/ckeditor5-engine/src/model/differ.js

@@ -931,10 +931,10 @@ export default class Differ {
 			}
 
 			if ( inc.type === 'refresh' ) {
-				// TOOD: This might be handled on other level.
 				if ( old.type === 'insert' ) {
+					// Refreshing newly inserted element makes no sense and should not be processed.
 					if ( inc.offset === old.offset && inc.howMany === old.howMany ) {
-						old.howMany = 0;
+						inc.nodesToHandle = 0;
 					}
 				}
 

+ 1 - 1
packages/ckeditor5-engine/tests/model/differ.js

@@ -1983,7 +1983,7 @@ describe( 'Differ', () => {
 				differ.refreshItem( slot );
 
 				expectChanges( [
-					{ type: 'refresh', name: 'slot', length: 1, position: model.createPositionBefore( slot ) }
+					{ type: 'insert', name: 'slot', length: 1, position: model.createPositionBefore( slot ) }
 				], true );
 			} );
 		} );