Forráskód Böngészése

Fixed: engine.treeController.ViewConversionDispatcher#_convertChildren not removing null values.

Szymon Cofalik 9 éve
szülő
commit
1d8a85ec72

+ 3 - 3
packages/ckeditor5-engine/src/treecontroller/viewconversiondispatcher.js

@@ -99,7 +99,7 @@ export default class ViewConversionDispatcher {
 	 * Creates a `ViewConversionDispatcher` that operates using passed API.
 	 *
 	 * @see engine.treeController.ViewConversionApi
-	 * @param {Object} conversionApi Additional properties for interface that will be passed to events fired
+	 * @param {Object} [conversionApi] Additional properties for interface that will be passed to events fired
 	 * by `ViewConversionDispatcher`.
 	 */
 	constructor( conversionApi = {} ) {
@@ -164,8 +164,8 @@ export default class ViewConversionDispatcher {
 		const viewChildren = Array.from( input.getChildren() );
 		const convertedChildren = viewChildren.map( ( viewChild ) => this._convertItem( viewChild, consumable, additionalData ) );
 
-		// Flatten.
-		return convertedChildren.reduce( ( a, b ) => a.concat( b ) );
+		// Flatten and remove nulls.
+		return convertedChildren.reduce( ( a, b ) => b ? a.concat( b ) : a, [] );
 	}
 
 	/**