8
0
Prechádzať zdrojové kódy

Changed: Enabled engine.treeView.ViewText as a parameter of engine.treeController.ViewConsumable.createFrom.

Szymon Cofalik 9 rokov pred
rodič
commit
7f0fd4ee44

+ 7 - 5
packages/ckeditor5-engine/src/treecontroller/viewconsumable.js

@@ -568,6 +568,12 @@ export default class ViewConsumable {
 			instance = new ViewConsumable();
 		}
 
+		if ( from instanceof ViewText ) {
+			instance.add( from );
+
+			return instance;
+		}
+
 		// Add `from` itself, if it is an element.
 		if ( from instanceof ViewElement ) {
 			instance.add( from, ViewConsumable.consumablesFromElement( from ) );
@@ -578,11 +584,7 @@ export default class ViewConsumable {
 		}
 
 		for ( let child of from.getChildren() ) {
-			if ( child instanceof ViewText ) {
-				instance.add( child );
-			} else {
-				instance = ViewConsumable.createFrom( child, instance );
-			}
+			instance = ViewConsumable.createFrom( child, instance );
 		}
 
 		return instance;