@ckeditor/ckeditor5-utils
Advanced tools
Comparing version 0.0.0-nightly-20230726.0 to 0.0.0-nightly-20230727.0
{ | ||
"name": "@ckeditor/ckeditor5-utils", | ||
"version": "0.0.0-nightly-20230726.0", | ||
"version": "0.0.0-nightly-20230727.0", | ||
"description": "Miscellaneous utilities used by CKEditor 5.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -11,5 +11,2 @@ /** | ||
* | ||
* **Note**: If there are no position coordinates found that meet the requirements (arguments of this helper), | ||
* `null` is returned. | ||
* | ||
* ```ts | ||
@@ -75,3 +72,3 @@ * // The element which is to be positioned. | ||
*/ | ||
export declare function getOptimalPosition({ element, target, positions, limiter, fitInViewport, viewportOffsetConfig }: Options): Position | null; | ||
export declare function getOptimalPosition({ element, target, positions, limiter, fitInViewport, viewportOffsetConfig }: Options): Position; | ||
/** | ||
@@ -78,0 +75,0 @@ * A position object which instances are created and used by the {@link module:utils/dom/position~getOptimalPosition} helper. |
@@ -13,4 +13,2 @@ /** | ||
import { isFunction } from 'lodash-es'; | ||
import getScrollableAncestors from './getscrollableancestors'; | ||
import getElementsIntersectionRect from './getelementsintersectionrect'; | ||
// @if CK_DEBUG_POSITION // const RectDrawer = require( '@ckeditor/ckeditor5-utils/tests/_utils/rectdrawer' ).default | ||
@@ -22,5 +20,2 @@ /** | ||
* | ||
* **Note**: If there are no position coordinates found that meet the requirements (arguments of this helper), | ||
* `null` is returned. | ||
* | ||
* ```ts | ||
@@ -105,8 +100,2 @@ * // The element which is to be positioned. | ||
const positionOptions = { targetRect, elementRect, positionedElementAncestor, viewportRect }; | ||
// Get intersection of all scrollable ancestors of `target`. | ||
const allScrollableAncestors = getScrollableAncestors(target); | ||
const ancestorsIntersectionRect = getElementsIntersectionRect(allScrollableAncestors, (viewportOffsetConfig || { top: 0 }).top); | ||
if (!ancestorsIntersectionRect || !targetRect.getVisible()) { | ||
return null; | ||
} | ||
// If there are no limits, just grab the very first position and be done with that drama. | ||
@@ -124,6 +113,6 @@ if (!limiter && !fitInViewport) { | ||
// @if CK_DEBUG_POSITION // } | ||
Object.assign(positionOptions, { limiterRect, viewportRect: ancestorsIntersectionRect }); | ||
Object.assign(positionOptions, { limiterRect, viewportRect }); | ||
// If there's no best position found, i.e. when all intersections have no area because | ||
// rects have no width or height, then just return `null` | ||
bestPosition = getBestPosition(positions, positionOptions); | ||
// rects have no width or height, then just use the first available position. | ||
bestPosition = getBestPosition(positions, positionOptions) || new PositionObject(positions[0], positionOptions); | ||
} | ||
@@ -150,3 +139,2 @@ return bestPosition; | ||
const { elementRect } = options; | ||
// @if CK_DEBUG_POSITION // RectDrawer.draw( elementRect, { outlineWidth: '5px', outlineColor: 'orange' }, 'elementRect' ); | ||
// This is when element is fully visible. | ||
@@ -249,3 +237,3 @@ const elementRectArea = elementRect.getArea(); | ||
this.config = config; | ||
this._positioningFunctionCoordinates = { left, top }; | ||
this._positioningFunctionCorrdinates = { left, top }; | ||
this._options = options; | ||
@@ -283,2 +271,5 @@ } | ||
} | ||
else { | ||
return limiterRect.getIntersectionArea(this._rect); | ||
} | ||
} | ||
@@ -292,3 +283,6 @@ return 0; | ||
const viewportRect = this._options.viewportRect; | ||
return viewportRect.getIntersectionArea(this._rect); | ||
if (viewportRect) { | ||
return viewportRect.getIntersectionArea(this._rect); | ||
} | ||
return 0; | ||
} | ||
@@ -303,3 +297,3 @@ /** | ||
} | ||
this._cachedRect = this._options.elementRect.clone().moveTo(this._positioningFunctionCoordinates.left, this._positioningFunctionCoordinates.top); | ||
this._cachedRect = this._options.elementRect.clone().moveTo(this._positioningFunctionCorrdinates.left, this._positioningFunctionCorrdinates.top); | ||
return this._cachedRect; | ||
@@ -306,0 +300,0 @@ } |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
declare const version = "0.0.0-nightly-20230726.0"; | ||
declare const version = "0.0.0-nightly-20230727.0"; | ||
export default version; | ||
@@ -8,0 +8,0 @@ export declare const releaseDate: Date; |
@@ -10,6 +10,6 @@ /** | ||
import CKEditorError from './ckeditorerror'; | ||
const version = '0.0.0-nightly-20230726.0'; | ||
const version = '0.0.0-nightly-20230727.0'; | ||
export default version; | ||
// The second argument is not a month. It is `monthIndex` and starts from `0`. | ||
export const releaseDate = new Date(2023, 6, 26); | ||
export const releaseDate = new Date(2023, 6, 27); | ||
/* istanbul ignore next -- @preserve */ | ||
@@ -16,0 +16,0 @@ const windowOrGlobal = typeof window === 'object' ? window : global; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
433268
10382