Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-utils

Package Overview
Dependencies
1
Maintainers
1
Versions
533
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 21.0.0 to 22.0.0

10

package.json
{
"name": "@ckeditor/ckeditor5-utils",
"version": "21.0.0",
"version": "22.0.0",
"description": "Miscellaneous utils used by CKEditor 5.",

@@ -15,6 +15,6 @@ "keywords": [

"devDependencies": {
"@ckeditor/ckeditor5-build-classic": "^21.0.0",
"@ckeditor/ckeditor5-editor-classic": "^21.0.0",
"@ckeditor/ckeditor5-core": "^21.0.0",
"@ckeditor/ckeditor5-engine": "^21.0.0",
"@ckeditor/ckeditor5-build-classic": "^22.0.0",
"@ckeditor/ckeditor5-editor-classic": "^22.0.0",
"@ckeditor/ckeditor5-core": "^22.0.0",
"@ckeditor/ckeditor5-engine": "^22.0.0",
"assertion-error": "^1.1.0",

@@ -21,0 +21,0 @@ "js-beautify": "^1.11.0"

@@ -204,7 +204,8 @@ /**

/**
* The index number has invalid value.
* The `index` passed to {@link module:utils/collection~Collection#addMany `Collection#addMany()`}
* is invalid. It must be a number between 0 and the the collection's length.
*
* @error collection-add-item-bad-index
*/
throw new CKEditorError( 'collection-add-item-invalid-index', this );
throw new CKEditorError( 'collection-add-item-invalid-index: The index passed to Collection#addMany() is invalid.', this );
}

@@ -649,3 +650,3 @@

*/
throw new CKEditorError( 'collection-add-invalid-id', this );
throw new CKEditorError( 'collection-add-invalid-id: This item\'s id should be a string.', this );
}

@@ -659,3 +660,3 @@

*/
throw new CKEditorError( 'collection-add-item-already-exists', this );
throw new CKEditorError( 'collection-add-item-already-exists: This item already exists in the collection.', this );
}

@@ -662,0 +663,0 @@ } else {

@@ -52,2 +52,4 @@ /**

* listener before being dispatched to any EventTarget beneath it in the DOM tree.
* @param {Boolean} [options.usePassive=false] Indicates that the function specified by listener will never call preventDefault()
* and prevents blocking browser's main thread by this event handler.
*/

@@ -183,2 +185,4 @@ listenTo( emitter, ...rest ) {

* listener before being dispatched to any EventTarget beneath it in the DOM tree.
* @param {Boolean} [options.usePassive=false] Indicates that the function specified by listener will never call preventDefault()
* and prevents blocking browser's main thread by this event handler.
*/

@@ -192,6 +196,11 @@ attach( event, callback, options = {} ) {

const domListener = this._createDomListener( event, !!options.useCapture );
const listenerOptions = {
capture: !!options.useCapture,
passive: !!options.usePassive
};
const domListener = this._createDomListener( event, listenerOptions );
// Attach the native DOM listener to DOM Node.
this._domNode.addEventListener( event, domListener, !!options.useCapture );
this._domNode.addEventListener( event, domListener, listenerOptions );

@@ -233,6 +242,9 @@ if ( !this._domListeners ) {

* @param {String} event The name of the event.
* @param {Boolean} useCapture Indicates whether the listener was created for capturing event.
* @param {Object} [options] Additional options.
* @param {Boolean} [options.capture=false] Indicates whether the listener was created for capturing event.
* @param {Boolean} [options.passive=false] Indicates that the function specified by listener will never call preventDefault()
* and prevents blocking browser's main thread by this event handler.
* @returns {Function} The DOM listener callback.
*/
_createDomListener( event, useCapture ) {
_createDomListener( event, options ) {
const domListener = domEvt => {

@@ -246,3 +258,3 @@ this.fire( event, domEvt );

domListener.removeListener = () => {
this._domNode.removeEventListener( event, domListener, useCapture );
this._domNode.removeEventListener( event, domListener, options );
delete this._domListeners[ event ];

@@ -249,0 +261,0 @@ };

@@ -81,3 +81,4 @@ /**

if ( isSourceRange ) {
copyRectProperties( this, Rect.getDomRangeRects( source )[ 0 ] );
const rangeRects = Rect.getDomRangeRects( source );
copyRectProperties( this, Rect.getBoundingRect( rangeRects ) );
} else {

@@ -385,2 +386,36 @@ copyRectProperties( this, source.getBoundingClientRect() );

}
/**
* Returns a bounding rectangle that contains all the given `rects`.
*
* @param {Iterable.<module:utils/dom/rect~Rect>} rects A list of rectangles that should be contained in the result rectangle.
* @returns {module:utils/dom/rect~Rect|null} Bounding rectangle or `null` if no `rects` were given.
*/
static getBoundingRect( rects ) {
const boundingRectData = {
left: Number.POSITIVE_INFINITY,
top: Number.POSITIVE_INFINITY,
right: Number.NEGATIVE_INFINITY,
bottom: Number.NEGATIVE_INFINITY
};
let rectangleCount = 0;
for ( const rect of rects ) {
rectangleCount++;
boundingRectData.left = Math.min( boundingRectData.left, rect.left );
boundingRectData.top = Math.min( boundingRectData.top, rect.top );
boundingRectData.right = Math.max( boundingRectData.right, rect.right );
boundingRectData.bottom = Math.max( boundingRectData.bottom, rect.bottom );
}
if ( rectangleCount == 0 ) {
return null;
}
boundingRectData.width = boundingRectData.right - boundingRectData.left;
boundingRectData.height = boundingRectData.bottom - boundingRectData.top;
return new Rect( boundingRectData );
}
}

@@ -387,0 +422,0 @@

@@ -171,8 +171,2 @@ /**

for ( const entry of entries ) {
// Do not execute callbacks for elements that are invisible.
// https://github.com/ckeditor/ckeditor5/issues/6570
if ( !entry.target.offsetParent ) {
continue;
}
const callbacks = ResizeObserver._getElementCallbacks( entry.target );

@@ -179,0 +173,0 @@

@@ -80,3 +80,8 @@ /**

if ( this._elements.has( element ) ) {
throw new CKEditorError( 'focusTracker-add-element-already-exist', this );
/**
* This element is already tracked by {@link module:utils/focustracker~FocusTracker}.
*
* @error focusTracker-add-element-already-exist
*/
throw new CKEditorError( 'focusTracker-add-element-already-exist: This element is already tracked by FocusTracker.', this );
}

@@ -83,0 +88,0 @@

@@ -14,3 +14,3 @@ /**

const version = '21.0.0';
const version = '22.0.0';

@@ -17,0 +17,0 @@ /* istanbul ignore next */

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc