Parcourir la source

Blocked adding children to the UIElement by dev-tools.

Oskar Wróbel il y a 8 ans
Parent
commit
c5221a0ba4

+ 4 - 0
packages/ckeditor5-engine/src/dev-utils/view.js

@@ -856,6 +856,10 @@ function _convertViewElements( rootNode ) {
 				throw new Error( `Parse error - cannot parse inside EmptyElement.` );
 			}
 
+			if ( convertedElement instanceof UIElement ) {
+				throw new Error( `Parse error - cannot parse inside UIElement.` );
+			}
+
 			convertedElement.appendChildren( _convertViewElements( child ) );
 		}
 

+ 6 - 0
packages/ckeditor5-engine/tests/dev-utils/view.js

@@ -653,5 +653,11 @@ describe( 'view test utils', () => {
 				parse( '<empty:img>foo bar</empty:img>' );
 			} ).to.throw( Error, 'Parse error - cannot parse inside EmptyElement.' );
 		} );
+
+		it( 'should throw an error if UIElement is not empty', () => {
+			expect( () => {
+				parse( '<ui:span>foo bar</ui:span>' );
+			} ).to.throw( Error, 'Parse error - cannot parse inside UIElement.' );
+		} );
 	} );
 } );