Explorar el Código

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

Aleksander Nowodzinski hace 5 años
padre
commit
1fac38ef24
Se han modificado 1 ficheros con 3 adiciones y 2 borrados
  1. 3 2
      packages/ckeditor5-utils/src/dom/position.js

+ 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;