Ver Fonte

Made the ViewStringify stringify the UIElements in the output.

Aleksander Nowodzinski há 7 anos atrás
pai
commit
6c0e8307b8
1 ficheiros alterados com 12 adições e 6 exclusões
  1. 12 6
      packages/ckeditor5-engine/src/dev-utils/view.js

+ 12 - 6
packages/ckeditor5-engine/src/dev-utils/view.js

@@ -7,6 +7,8 @@
  * @module engine/dev-utils/view
  * @module engine/dev-utils/view
  */
  */
 
 
+/* globals document */
+
 /**
 /**
  * Collection of methods for manipulating the {@link module:engine/view/view view} for testing purposes.
  * Collection of methods for manipulating the {@link module:engine/view/view view} for testing purposes.
  */
  */
@@ -652,13 +654,17 @@ class ViewStringify {
 				callback( this._stringifyElementOpen( root ) );
 				callback( this._stringifyElementOpen( root ) );
 			}
 			}
 
 
-			let offset = 0;
-			callback( this._stringifyElementRanges( root, offset ) );
-
-			for ( const child of root.getChildren() ) {
-				this._walkView( child, callback );
-				offset++;
+			if ( root.is( 'uiElement' ) ) {
+				callback( root.render( document ).innerHTML );
+			} else {
+				let offset = 0;
 				callback( this._stringifyElementRanges( root, offset ) );
 				callback( this._stringifyElementRanges( root, offset ) );
+
+				for ( const child of root.getChildren() ) {
+					this._walkView( child, callback );
+					offset++;
+					callback( this._stringifyElementRanges( root, offset ) );
+				}
 			}
 			}
 
 
 			if ( root.is( 'element' ) && !ignore ) {
 			if ( root.is( 'element' ) && !ignore ) {