Kaynağa Gözat

Aligned dev-utils with new Batch API.

Oskar Wróbel 8 yıl önce
ebeveyn
işleme
5acb308580

+ 4 - 3
packages/ckeditor5-engine/src/dev-utils/model.js

@@ -113,9 +113,10 @@ export function setData( document, data, options = {} ) {
 
 	document.enqueueChanges( () => {
 		// Replace existing model in document by new one.
-		document.batch( options.batchType || 'transparent' )
-			.remove( ModelRange.createIn( modelRoot ) )
-			.insert( ModelPosition.createAt( modelRoot, 0 ), modelDocumentFragment );
+		const batch = document.batch( options.batchType || 'transparent' );
+
+		batch.remove( ModelRange.createIn( modelRoot ) );
+		batch.insert( modelDocumentFragment, modelRoot );
 
 		// Clean up previous document selection.
 		document.selection.clearAttributes();