@ckeditor/ckeditor5-utils
Advanced tools
Comparing version 0.0.0-nightly-20241121.0 to 0.0.0-nightly-20241122.0
@@ -10,2 +10,5 @@ /** | ||
/** | ||
* @module utils/splicearray | ||
*/ | ||
/** | ||
* Splices one array into another. To be used instead of `Array.prototype.splice` as the latter may | ||
@@ -12,0 +15,0 @@ * throw "Maximum call stack size exceeded" when passed huge number of items to insert. |
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
declare const version = "0.0.0-nightly-20241121.0"; | ||
declare const version = "0.0.0-nightly-20241122.0"; | ||
export default version; | ||
@@ -12,0 +12,0 @@ export declare const releaseDate: Date; |
{ | ||
"name": "@ckeditor/ckeditor5-utils", | ||
"version": "0.0.0-nightly-20241121.0", | ||
"version": "0.0.0-nightly-20241122.0", | ||
"description": "Miscellaneous utilities used by CKEditor 5.", | ||
@@ -16,3 +16,3 @@ "keywords": [ | ||
"lodash-es": "4.17.21", | ||
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20241121.0" | ||
"@ckeditor/ckeditor5-ui": "0.0.0-nightly-20241122.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "author": "CKSource (http://cksource.com/)", |
@@ -393,16 +393,15 @@ /** | ||
function getCallbacksForEvent(source, eventName) { | ||
let event; | ||
if (!source._events || !(event = source._events[eventName]) || !event.callbacks.length) { | ||
// There are no callbacks registered for specified eventName. | ||
// But this could be a specific-type event that is in a namespace. | ||
if (eventName.indexOf(':') > -1) { | ||
// If the eventName is specific, try to find callback lists for more generic event. | ||
return getCallbacksForEvent(source, eventName.substr(0, eventName.lastIndexOf(':'))); | ||
if (!source._events) { | ||
return null; | ||
} | ||
let currentEventName = eventName; | ||
do { | ||
const event = source._events[currentEventName]; | ||
if (event && event.callbacks && event.callbacks.length) { | ||
return event.callbacks; | ||
} | ||
else { | ||
// If this is a top-level generic event, return null; | ||
return null; | ||
} | ||
} | ||
return event.callbacks; | ||
const colonIndex = currentEventName.lastIndexOf(':'); | ||
currentEventName = colonIndex > -1 ? currentEventName.substring(0, colonIndex) : ''; | ||
} while (currentEventName); | ||
return null; | ||
} | ||
@@ -409,0 +408,0 @@ /** |
@@ -6,2 +6,5 @@ /** | ||
/** | ||
* @module utils/splicearray | ||
*/ | ||
/** | ||
* Splices one array into another. To be used instead of `Array.prototype.splice` as the latter may | ||
@@ -8,0 +11,0 @@ * throw "Maximum call stack size exceeded" when passed huge number of items to insert. |
@@ -8,3 +8,2 @@ /** | ||
*/ | ||
const BIG_CHUNK_SIZE = 10000; | ||
/** | ||
@@ -32,11 +31,16 @@ * Splices one array into another. To be used instead of `Array.prototype.splice` as the latter may | ||
export default function spliceArray(target, source, start, count) { | ||
// In case of performance problems, see: https://github.com/ckeditor/ckeditor5/pull/12429/files#r965850568 | ||
if (Math.max(source.length, target.length) > BIG_CHUNK_SIZE) { | ||
return target.slice(0, start).concat(source).concat(target.slice(start + count, target.length)); | ||
const targetLength = target.length; | ||
const sourceLength = source.length; | ||
const result = new Array(targetLength - count + sourceLength); | ||
let i = 0; | ||
for (; i < start && i < targetLength; i++) { | ||
result[i] = target[i]; | ||
} | ||
else { | ||
const newTarget = Array.from(target); | ||
newTarget.splice(start, count, ...source); | ||
return newTarget; | ||
for (let j = 0; j < sourceLength; j++, i++) { | ||
result[i] = source[j]; | ||
} | ||
for (let k = start + count; k < targetLength; k++, i++) { | ||
result[i] = target[k]; | ||
} | ||
return result; | ||
} |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
declare const version = "0.0.0-nightly-20241121.0"; | ||
declare const version = "0.0.0-nightly-20241122.0"; | ||
export default version; | ||
@@ -8,0 +8,0 @@ export declare const releaseDate: Date; |
@@ -9,6 +9,6 @@ /** | ||
import CKEditorError from './ckeditorerror.js'; | ||
const version = '0.0.0-nightly-20241121.0'; | ||
const version = '0.0.0-nightly-20241122.0'; | ||
export default version; | ||
// The second argument is not a month. It is `monthIndex` and starts from `0`. | ||
export const releaseDate = new Date(2024, 10, 21); | ||
export const releaseDate = new Date(2024, 10, 22); | ||
/* istanbul ignore next -- @preserve */ | ||
@@ -15,0 +15,0 @@ if (globalThis.CKEDITOR_VERSION) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
21864
2121308
+ Added@ckeditor/ckeditor5-core@0.0.0-nightly-20241122.0(transitive)
+ Added@ckeditor/ckeditor5-engine@0.0.0-nightly-20241122.0(transitive)
+ Added@ckeditor/ckeditor5-ui@0.0.0-nightly-20241122.0(transitive)
+ Added@ckeditor/ckeditor5-watchdog@0.0.0-nightly-20241122.0(transitive)
- Removed@ckeditor/ckeditor5-core@0.0.0-nightly-20241121.0(transitive)
- Removed@ckeditor/ckeditor5-engine@0.0.0-nightly-20241121.0(transitive)
- Removed@ckeditor/ckeditor5-ui@0.0.0-nightly-20241121.0(transitive)
- Removed@ckeditor/ckeditor5-watchdog@0.0.0-nightly-20241121.0(transitive)