瀏覽代碼

Blocked adding children to the UIElement by dev-tools.

Oskar Wróbel 8 年之前
父節點
當前提交
c5221a0ba4
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 4 0
      packages/ckeditor5-engine/src/dev-utils/view.js
  2. 6 0
      packages/ckeditor5-engine/tests/dev-utils/view.js

+ 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.' );
+		} );
 	} );
 } );