|
|
@@ -168,12 +168,9 @@ describe( 'Paragraph feature', () => {
|
|
|
} );
|
|
|
|
|
|
it( 'should not fail when text is not allowed in paragraph', () => {
|
|
|
- model.schema.on( 'checkChild', ( evt, args ) => {
|
|
|
- const def = model.schema.getDefinition( args[ 1 ] );
|
|
|
-
|
|
|
- if ( args[ 0 ].endsWith( '$root paragraph' ) && def.name == '$text' ) {
|
|
|
- evt.stop();
|
|
|
- evt.return = false;
|
|
|
+ model.schema.addChildCheck( ( ctx, childDef ) => {
|
|
|
+ if ( ctx.endsWith( '$root paragraph' ) && childDef.name == '$text' ) {
|
|
|
+ return false;
|
|
|
}
|
|
|
} );
|
|
|
|
|
|
@@ -408,12 +405,9 @@ describe( 'Paragraph feature', () => {
|
|
|
} );
|
|
|
|
|
|
it( 'should not fix root which does not allow paragraph', () => {
|
|
|
- model.schema.on( 'checkChild', ( evt, args ) => {
|
|
|
- const def = model.schema.getDefinition( args[ 1 ] );
|
|
|
-
|
|
|
- if ( args[ 0 ].endsWith( '$root' ) && def.name == 'paragraph' ) {
|
|
|
- evt.stop();
|
|
|
- evt.return = false;
|
|
|
+ model.schema.addChildCheck( ( ctx, childDef ) => {
|
|
|
+ if ( ctx.endsWith( '$root' ) && childDef.name == 'paragraph' ) {
|
|
|
+ return false;
|
|
|
}
|
|
|
} );
|
|
|
|