Răsfoiți Sursa

Fourth batch of changes aligning schema use to the new API.

Piotrek Koszuliński 8 ani în urmă
părinte
comite
57473097ad
1 a modificat fișierele cu 8 adăugiri și 1 ștergeri
  1. 8 1
      packages/ckeditor5-typing/tests/deletecommand.js

+ 8 - 1
packages/ckeditor5-typing/tests/deletecommand.js

@@ -244,7 +244,14 @@ describe( 'DeleteCommand', () => {
 		} );
 		} );
 
 
 		it( 'does not replace an element if a paragraph is not allowed in current position', () => {
 		it( 'does not replace an element if a paragraph is not allowed in current position', () => {
-			model.schema.xdisallow( 'paragraph', { allowIn: '$root' } );
+			model.schema.on( 'checkChild', ( evt, args ) => {
+				const rule = model.schema.getRule( args[ 1 ] );
+
+				if ( args[ 0 ].matchEnd( '$root' ) && rule.name == 'paragraph' ) {
+					evt.stop();
+					evt.return = false;
+				}
+			} );
 
 
 			setData( model, '<heading1>[]</heading1>' );
 			setData( model, '<heading1>[]</heading1>' );