@ckeditor/ckeditor5-utils 46.0.0 → 46.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +25 -25
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/dom/global.d.ts +2 -2
- package/src/dom/global.js +4 -4
- package/src/version.d.ts +1 -1
- package/src/version.js +2 -2
package/dist/index.js
CHANGED
|
@@ -27,10 +27,10 @@ import { isObject as isObject$1, isString, isPlainObject, cloneDeepWith, isEleme
|
|
|
27
27
|
*
|
|
28
28
|
* console.log( global.window.innerWidth );
|
|
29
29
|
* ```
|
|
30
|
-
*/ let
|
|
30
|
+
*/ let globalVar; // named globalVar instead of global: https://github.com/ckeditor/ckeditor5/issues/12971
|
|
31
31
|
// In some environments window and document API might not be available.
|
|
32
32
|
try {
|
|
33
|
-
|
|
33
|
+
globalVar = {
|
|
34
34
|
window,
|
|
35
35
|
document
|
|
36
36
|
};
|
|
@@ -40,7 +40,7 @@ try {
|
|
|
40
40
|
// We only handle this so loading editor in environments without window and document doesn't fail.
|
|
41
41
|
// For better DX we shouldn't introduce mixed types and require developers to check the type manually.
|
|
42
42
|
// This module should not be used on purpose in any environment outside browser.
|
|
43
|
-
|
|
43
|
+
globalVar = {
|
|
44
44
|
window: {},
|
|
45
45
|
document: {}
|
|
46
46
|
};
|
|
@@ -171,7 +171,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
|
|
|
171
171
|
*
|
|
172
172
|
* @internal
|
|
173
173
|
*/ function isMediaForcedColors() {
|
|
174
|
-
return
|
|
174
|
+
return globalVar.window.matchMedia ? globalVar.window.matchMedia('(forced-colors: active)').matches : false;
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
177
|
* Checks if the user enabled "prefers reduced motion" setting in browser.
|
|
@@ -180,7 +180,7 @@ const userAgent = /* #__PURE__ */ getUserAgent();
|
|
|
180
180
|
*
|
|
181
181
|
* @internal
|
|
182
182
|
*/ function isMotionReduced() {
|
|
183
|
-
return
|
|
183
|
+
return globalVar.window.matchMedia ? globalVar.window.matchMedia('(prefers-reduced-motion)').matches : false;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
/**
|
|
@@ -987,9 +987,9 @@ function isObject(structure) {
|
|
|
987
987
|
];
|
|
988
988
|
}
|
|
989
989
|
|
|
990
|
-
const version = '46.0.0';
|
|
990
|
+
const version = '46.0.1-alpha.0';
|
|
991
991
|
// The second argument is not a month. It is `monthIndex` and starts from `0`.
|
|
992
|
-
const releaseDate = new Date(2025, 6,
|
|
992
|
+
const releaseDate = new Date(2025, 6, 30);
|
|
993
993
|
/* istanbul ignore next -- @preserve */ if (globalThis.CKEDITOR_VERSION) {
|
|
994
994
|
/**
|
|
995
995
|
* This error is thrown when, due to a mistake in the way CKEditor 5 was installed,
|
|
@@ -2493,7 +2493,7 @@ function DomEmitterMixin(base) {
|
|
|
2493
2493
|
class Mixin extends base {
|
|
2494
2494
|
listenTo(emitter, event, callback, options = {}) {
|
|
2495
2495
|
// Check if emitter is an instance of DOM Node. If so, use corresponding ProxyEmitter (or create one if not existing).
|
|
2496
|
-
if (isNode(emitter) || isWindow(emitter) || emitter instanceof
|
|
2496
|
+
if (isNode(emitter) || isWindow(emitter) || emitter instanceof globalVar.window.EventTarget) {
|
|
2497
2497
|
const proxyOptions = {
|
|
2498
2498
|
capture: !!options.useCapture,
|
|
2499
2499
|
passive: !!options.usePassive
|
|
@@ -2507,7 +2507,7 @@ function DomEmitterMixin(base) {
|
|
|
2507
2507
|
}
|
|
2508
2508
|
stopListening(emitter, event, callback) {
|
|
2509
2509
|
// Check if the emitter is an instance of DOM Node. If so, forward the call to the corresponding ProxyEmitters.
|
|
2510
|
-
if (isNode(emitter) || isWindow(emitter) || emitter instanceof
|
|
2510
|
+
if (isNode(emitter) || isWindow(emitter) || emitter instanceof globalVar.window.EventTarget) {
|
|
2511
2511
|
const proxyEmitters = this._getAllProxyEmitters(emitter);
|
|
2512
2512
|
for (const proxy of proxyEmitters){
|
|
2513
2513
|
this.stopListening(proxy, event, callback);
|
|
@@ -2720,7 +2720,7 @@ function DomEmitterMixin(base) {
|
|
|
2720
2720
|
return null;
|
|
2721
2721
|
}
|
|
2722
2722
|
while(element.tagName != 'BODY'){
|
|
2723
|
-
const overflow = element.style.overflowY ||
|
|
2723
|
+
const overflow = element.style.overflowY || globalVar.window.getComputedStyle(element).overflowY;
|
|
2724
2724
|
if (overflow === 'auto' || overflow === 'scroll') {
|
|
2725
2725
|
break;
|
|
2726
2726
|
}
|
|
@@ -2849,7 +2849,7 @@ function DomEmitterMixin(base) {
|
|
|
2849
2849
|
if (!element || !element.parentNode) {
|
|
2850
2850
|
return null;
|
|
2851
2851
|
}
|
|
2852
|
-
if (element.offsetParent ===
|
|
2852
|
+
if (element.offsetParent === globalVar.document.body) {
|
|
2853
2853
|
return null;
|
|
2854
2854
|
}
|
|
2855
2855
|
return element.offsetParent;
|
|
@@ -3177,7 +3177,7 @@ const rectProperties = [
|
|
|
3177
3177
|
/**
|
|
3178
3178
|
* Recalculates screen coordinates to coordinates relative to the positioned ancestor offset.
|
|
3179
3179
|
*/ toAbsoluteRect() {
|
|
3180
|
-
const { scrollX, scrollY } =
|
|
3180
|
+
const { scrollX, scrollY } = globalVar.window;
|
|
3181
3181
|
const absoluteRect = this.clone().moveBy(scrollX, scrollY);
|
|
3182
3182
|
if (isDomElement(absoluteRect._source)) {
|
|
3183
3183
|
const positionedAncestor = getPositionedAncestor(absoluteRect._source);
|
|
@@ -3447,7 +3447,7 @@ const rectProperties = [
|
|
|
3447
3447
|
/**
|
|
3448
3448
|
* Creates the single native observer shared across all `ResizeObserver` instances.
|
|
3449
3449
|
*/ static _createObserver() {
|
|
3450
|
-
ResizeObserver._observerInstance = new
|
|
3450
|
+
ResizeObserver._observerInstance = new globalVar.window.ResizeObserver((entries)=>{
|
|
3451
3451
|
for (const entry of entries){
|
|
3452
3452
|
const callbacks = ResizeObserver._getElementCallbacks(entry.target);
|
|
3453
3453
|
if (callbacks) {
|
|
@@ -3542,7 +3542,7 @@ const rectProperties = [
|
|
|
3542
3542
|
* @param name Attribute name.
|
|
3543
3543
|
*/ function isValidAttributeName(name) {
|
|
3544
3544
|
try {
|
|
3545
|
-
|
|
3545
|
+
globalVar.document.createAttribute(name);
|
|
3546
3546
|
} catch {
|
|
3547
3547
|
return false;
|
|
3548
3548
|
}
|
|
@@ -3739,7 +3739,7 @@ const rectProperties = [
|
|
|
3739
3739
|
left: 0,
|
|
3740
3740
|
right: 0
|
|
3741
3741
|
}, viewportOffsetConfig);
|
|
3742
|
-
const viewportRect = new Rect(
|
|
3742
|
+
const viewportRect = new Rect(globalVar.window);
|
|
3743
3743
|
viewportRect.top += viewportOffsetConfig.top;
|
|
3744
3744
|
viewportRect.height -= viewportOffsetConfig.top;
|
|
3745
3745
|
viewportRect.bottom -= viewportOffsetConfig.bottom;
|
|
@@ -3892,7 +3892,7 @@ const rectProperties = [
|
|
|
3892
3892
|
/**
|
|
3893
3893
|
* Returns the visual viewport offsets to adjust elements with `position: fixed` style.
|
|
3894
3894
|
*/ function getVisualViewportOffset() {
|
|
3895
|
-
const visualViewport =
|
|
3895
|
+
const visualViewport = globalVar.window.visualViewport;
|
|
3896
3896
|
if (!visualViewport || !(env.isiOS || env.isSafari)) {
|
|
3897
3897
|
return {
|
|
3898
3898
|
left: 0,
|
|
@@ -4558,8 +4558,8 @@ function splitKeystrokeText(keystroke) {
|
|
|
4558
4558
|
];
|
|
4559
4559
|
}
|
|
4560
4560
|
|
|
4561
|
-
/* istanbul ignore else -- @preserve */ if (!
|
|
4562
|
-
|
|
4561
|
+
/* istanbul ignore else -- @preserve */ if (!globalVar.window.CKEDITOR_TRANSLATIONS) {
|
|
4562
|
+
globalVar.window.CKEDITOR_TRANSLATIONS = {};
|
|
4563
4563
|
}
|
|
4564
4564
|
/**
|
|
4565
4565
|
* Adds translations to existing ones or overrides the existing translations. These translations will later
|
|
@@ -4646,10 +4646,10 @@ function splitKeystrokeText(keystroke) {
|
|
|
4646
4646
|
* should support plural forms.
|
|
4647
4647
|
* @param getPluralForm A function that returns the plural form index (a number).
|
|
4648
4648
|
*/ function add(language, translations, getPluralForm) {
|
|
4649
|
-
if (!
|
|
4650
|
-
|
|
4649
|
+
if (!globalVar.window.CKEDITOR_TRANSLATIONS[language]) {
|
|
4650
|
+
globalVar.window.CKEDITOR_TRANSLATIONS[language] = {};
|
|
4651
4651
|
}
|
|
4652
|
-
const languageTranslations =
|
|
4652
|
+
const languageTranslations = globalVar.window.CKEDITOR_TRANSLATIONS[language];
|
|
4653
4653
|
languageTranslations.dictionary = languageTranslations.dictionary || {};
|
|
4654
4654
|
languageTranslations.getPluralForm = getPluralForm || languageTranslations.getPluralForm;
|
|
4655
4655
|
Object.assign(languageTranslations.dictionary, translations);
|
|
@@ -4703,7 +4703,7 @@ function splitKeystrokeText(keystroke) {
|
|
|
4703
4703
|
quantity
|
|
4704
4704
|
});
|
|
4705
4705
|
}
|
|
4706
|
-
const normalizedTranslations = translations ||
|
|
4706
|
+
const normalizedTranslations = translations || globalVar.window.CKEDITOR_TRANSLATIONS;
|
|
4707
4707
|
const numberOfLanguages = getNumberOfLanguages(normalizedTranslations);
|
|
4708
4708
|
if (numberOfLanguages === 1) {
|
|
4709
4709
|
// Override the language to the only supported one.
|
|
@@ -4733,8 +4733,8 @@ function splitKeystrokeText(keystroke) {
|
|
|
4733
4733
|
*
|
|
4734
4734
|
* @internal
|
|
4735
4735
|
*/ function _clear() {
|
|
4736
|
-
if (
|
|
4737
|
-
|
|
4736
|
+
if (globalVar.window.CKEDITOR_TRANSLATIONS) {
|
|
4737
|
+
globalVar.window.CKEDITOR_TRANSLATIONS = {};
|
|
4738
4738
|
}
|
|
4739
4739
|
}
|
|
4740
4740
|
/**
|
|
@@ -6553,5 +6553,5 @@ function buildEmojiRegexp() {
|
|
|
6553
6553
|
return new RegExp(sequence, 'ug');
|
|
6554
6554
|
}
|
|
6555
6555
|
|
|
6556
|
-
export { CKEditorError, Collection, Config, DOCUMENTATION_URL, DomEmitterMixin, ElementReplacer, EmitterMixin, EventInfo, FocusTracker, KeystrokeHandler, Locale, ObservableMixin, Rect, ResizeObserver, _clear as _clearTranslations, _getEmitterId, _getEmitterListenedTo, getUserAgent as _getUserAgent, isAndroid as _isAndroid, isBlink as _isBlink, isGecko as _isGecko, isMac as _isMac, isMediaForcedColors as _isMediaForcedColors, isMotionReduced as _isMotionReduced, isRegExpUnicodePropertySupported as _isRegExpUnicodePropertySupported, isSafari as _isSafari, isWindows as _isWindows, isiOS as _isiOS, _setEmitterId, _translate, _unifyTranslations, abortableDebounce, add, areConnectedThroughProperties, collectStylesheets, compareArrays, count, crc32, createElement, delay, diff, diffToChanges, env, exponentialDelay, fastDiff, findClosestScrollableAncestor, first, formatHtml, getAncestors, getBorderWidths, getCode, getCommonAncestor, getDataFromElement, getEnvKeystrokeText, getLanguageDirection, getLocalizedArrowKeyCodeDirection, getOptimalPosition, getPositionedAncestor, getRangeFromMouseEvent, getVisualViewportOffset, global, indexOf, insertAt, insertToPriorityArray, isArrowKeyCode, isCombiningMark, isComment, isForwardArrowKeyCode, isHighSurrogateHalf, isInsideCombinedSymbol, isInsideEmojiSequence, isInsideSurrogatePair, isIterable, isLowSurrogateHalf, isNode, isRange, isText, isValidAttributeName, isViewWithFocusTracker, isVisible, isWindow, keyCodes, logError, logWarning, mapsEqual, nth, objectToMap, parseBase64EncodedObject, parseKeystroke, priorities, releaseDate, remove, retry, scrollAncestorsToShowTarget, scrollViewportToShowTarget, setDataInElement, spliceArray, spy, toArray, toMap, toUnit, uid, version, wait };
|
|
6556
|
+
export { CKEditorError, Collection, Config, DOCUMENTATION_URL, DomEmitterMixin, ElementReplacer, EmitterMixin, EventInfo, FocusTracker, KeystrokeHandler, Locale, ObservableMixin, Rect, ResizeObserver, _clear as _clearTranslations, _getEmitterId, _getEmitterListenedTo, getUserAgent as _getUserAgent, isAndroid as _isAndroid, isBlink as _isBlink, isGecko as _isGecko, isMac as _isMac, isMediaForcedColors as _isMediaForcedColors, isMotionReduced as _isMotionReduced, isRegExpUnicodePropertySupported as _isRegExpUnicodePropertySupported, isSafari as _isSafari, isWindows as _isWindows, isiOS as _isiOS, _setEmitterId, _translate, _unifyTranslations, abortableDebounce, add, areConnectedThroughProperties, collectStylesheets, compareArrays, count, crc32, createElement, delay, diff, diffToChanges, env, exponentialDelay, fastDiff, findClosestScrollableAncestor, first, formatHtml, getAncestors, getBorderWidths, getCode, getCommonAncestor, getDataFromElement, getEnvKeystrokeText, getLanguageDirection, getLocalizedArrowKeyCodeDirection, getOptimalPosition, getPositionedAncestor, getRangeFromMouseEvent, getVisualViewportOffset, globalVar as global, indexOf, insertAt, insertToPriorityArray, isArrowKeyCode, isCombiningMark, isComment, isForwardArrowKeyCode, isHighSurrogateHalf, isInsideCombinedSymbol, isInsideEmojiSequence, isInsideSurrogatePair, isIterable, isLowSurrogateHalf, isNode, isRange, isText, isValidAttributeName, isViewWithFocusTracker, isVisible, isWindow, keyCodes, logError, logWarning, mapsEqual, nth, objectToMap, parseBase64EncodedObject, parseKeystroke, priorities, releaseDate, remove, retry, scrollAncestorsToShowTarget, scrollViewportToShowTarget, setDataInElement, spliceArray, spy, toArray, toMap, toUnit, uid, version, wait };
|
|
6557
6557
|
//# sourceMappingURL=index.js.map
|