Sfoglia il codice sorgente

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

Piotrek Koszuliński 8 anni fa
parent
commit
b6513aac14

+ 2 - 2
packages/ckeditor5-block-quote/src/blockquoteengine.js

@@ -40,9 +40,9 @@ export default class BlockQuoteEngine extends Plugin {
 		schema.on( 'checkChild', ( evt, args ) => {
 			const ctx = args[ 0 ];
 			const child = args[ 1 ];
-			const childRule = schema.getRule( child );
+			const childRule = schema.getDefinition( child );
 
-			if ( childRule && childRule.name == 'blockQuote' && ctx.matchEnd( 'blockQuote' ) ) {
+			if ( childRule && childRule.name == 'blockQuote' && ctx.endsWith( 'blockQuote' ) ) {
 				evt.stop();
 				evt.return = false;
 			}

+ 4 - 4
packages/ckeditor5-block-quote/tests/blockquotecommand.js

@@ -126,9 +126,9 @@ describe( 'BlockQuoteCommand', () => {
 			'(because mQ is not allowed in its parent)',
 			() => {
 				model.schema.on( 'checkChild', ( evt, args ) => {
-					const rule = model.schema.getRule( args[ 1 ] );
+					const def = model.schema.getDefinition( args[ 1 ] );
 
-					if ( rule.name == 'blockQuote' ) {
+					if ( def.name == 'blockQuote' ) {
 						evt.stop();
 						evt.return = false;
 					}
@@ -381,10 +381,10 @@ describe( 'BlockQuoteCommand', () => {
 				// blockQuote is allowed in root, but fooBlock can not be inside blockQuote.
 				model.schema.register( 'fooBlock', { inheritAllFrom: '$block' } );
 				model.schema.on( 'checkChild', ( evt, args ) => {
-					const rule = model.schema.getRule( args[ 1 ] );
+					const def = model.schema.getDefinition( args[ 1 ] );
 					const ctx = args[ 0 ];
 
-					if ( ctx.matchEnd( 'blockQuote' ) && rule.name == 'fooBlock' ) {
+					if ( ctx.endsWith( 'blockQuote' ) && def.name == 'fooBlock' ) {
 						evt.stop();
 						evt.return = false;
 					}