8
0
Эх сурвалжийг харах

Secured the getOptimalPosition() algorithm against edge-cases when position functions have no name.

Aleksander Nowodzinski 5 жил өмнө
parent
commit
1fac38ef24

+ 3 - 2
packages/ckeditor5-utils/src/dom/position.js

@@ -211,12 +211,13 @@ function processPositionsToAreas( positions, { targetRect, elementRect, limiterR
 	const elementRectArea = elementRect.getArea();
 
 	for ( const position of positions ) {
-		const [ positionName, positionRect ] = getPositionNameAndRect( position, targetRect, elementRect ) || [];
+		const positionData = getPositionNameAndRect( position, targetRect, elementRect );
 
-		if ( !positionName ) {
+		if ( !positionData ) {
 			continue;
 		}
 
+		const [ positionName, positionRect ] = positionData;
 		let limiterIntersectArea = 0;
 		let viewportIntersectArea = 0;