Browse Source

Remove intermediate array.

Maciej Gołaszewski 5 years ago
parent
commit
61fd0d2a2f

+ 8 - 0
packages/ckeditor5-engine/src/model/differ.js

@@ -110,6 +110,14 @@ export default class Differ {
 		return this._changesInElement.size == 0 && this._changedMarkers.size == 0;
 	}
 
+	/**
+	 * Marks given `item` in differ to be re-inserted. It means that the item will be marked as removed and inserted in the differ changes
+	 * set. The `item` and all its children will be effectively re-converted when differ changes will be handled by a dispatcher.
+	 *
+	 * *Note*: To reconvert only `item` without reconverting children use {@link #refreshItem `differ.refreshItem()`}.
+	 *
+	 * @param {module:engine/model/item~Item} item Item to refresh.
+	 */
 	reInsertItem( item ) {
 		if ( this._isInInsertedElement( item.parent ) ) {
 			return;

+ 1 - 3
packages/ckeditor5-table/src/converters/table-cell-refresh-post-fixer.js

@@ -26,11 +26,9 @@ function tableCellRefreshPostFixer( model ) {
 	const differ = model.document.differ;
 
 	const changesForCells = new Map();
-	const changes = [ ...differ.getChanges() ];
 
-	// Updated refresh algorithm.
 	// 1. Gather all changes inside table cell.
-	changes.forEach( change => {
+	differ.getChanges().forEach( change => {
 		const parent = change.type == 'attribute' ? change.range.start.parent : change.position.parent;
 
 		if ( !parent.is( 'element', 'tableCell' ) ) {