Przeglądaj źródła

Removed limitElement from Schema#findAllowedParent().

Oskar Wróbel 7 lat temu
rodzic
commit
b4008867ad

+ 1 - 6
packages/ckeditor5-engine/src/model/schema.js

@@ -676,10 +676,9 @@ export default class Schema {
 	 *
 	 * @params {module:engine/model/node~Node} node Node for which allowed parent should be found.
 	 * @params {module:engine/model/position~Position} position Position from searching will start.
-	 * @params {module:engine/model/element~Element} [limitElement] Custom limit element.
 	 * @returns {module:engine/model/element~Element|null} element Allowed parent or null if nothing was found.
 	 */
-	findAllowedParent( node, position, limitElement ) {
+	findAllowedParent( node, position ) {
 		let parent = position.parent;
 
 		while ( parent ) {
@@ -691,10 +690,6 @@ export default class Schema {
 				return null;
 			}
 
-			if ( parent === limitElement ) {
-				return null;
-			}
-
 			parent = parent.parent;
 		}
 

+ 1 - 15
packages/ckeditor5-engine/tests/model/schema.js

@@ -1137,7 +1137,7 @@ describe( 'Schema', () => {
 		} );
 	} );
 
-	describe( 'findAllowedParent', () => {
+	describe( 'findAllowedParent()', () => {
 		beforeEach( () => {
 			schema.register( '$root' );
 			schema.register( 'blockQuote', {
@@ -1188,20 +1188,6 @@ describe( 'Schema', () => {
 
 			expect( parent ).to.null;
 		} );
-
-		it( 'should use custom limit element nad return null if is reached', () => {
-			// $root is allowed ancestor for blockQuote.
-			const node = new Element( 'blockQuote' );
-
-			const parent = schema.findAllowedParent(
-				node,
-				Position.createAt( r1bQp ),
-				// However lest stop searching when blockQuote is reached.
-				r1bQ
-			);
-
-			expect( parent ).to.null;
-		} );
 	} );
 
 	describe( 'removeDisallowedAttributes()', () => {