@ckeditor/ckeditor5-utils 33.0.0 → 34.2.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/LICENSE.md CHANGED
@@ -2,7 +2,7 @@ Software License Agreement
2
2
  ==========================
3
3
 
4
4
  **CKEditor 5 utilities** – https://github.com/ckeditor/ckeditor5-utils <br>
5
- Copyright (c) 2003-2022, [CKSource](http://cksource.com) Holding sp. z o.o. All rights reserved.
5
+ Copyright (c) 2003-2022, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
8
 
@@ -18,4 +18,4 @@ The following libraries are included in CKEditor under the [MIT license](https:/
18
18
  Trademarks
19
19
  ----------
20
20
 
21
- **CKEditor** is a trademark of [CKSource](http://cksource.com) Holding sp. z o.o. All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
21
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
package/README.md CHANGED
@@ -3,7 +3,8 @@ CKEditor 5 utilities
3
3
 
4
4
  [![npm version](https://badge.fury.io/js/%40ckeditor%2Fckeditor5-utils.svg)](https://www.npmjs.com/package/@ckeditor/ckeditor5-utils)
5
5
  [![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5?branch=master)
6
- [![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://travis-ci.com/ckeditor/ckeditor5)
6
+ [![Build Status](https://travis-ci.com/ckeditor/ckeditor5.svg?branch=master)](https://app.travis-ci.com/github/ckeditor/ckeditor5)
7
+ ![Dependency Status](https://img.shields.io/librariesio/release/npm/@ckeditor/ckeditor5-utils)
7
8
 
8
9
  Various utilities used by CKEditor 5 and its features. This is a sort of CKEditor 5's standard library.
9
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-utils",
3
- "version": "33.0.0",
3
+ "version": "34.2.0",
4
4
  "description": "Miscellaneous utilities used by CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -14,10 +14,10 @@
14
14
  "lodash-es": "^4.17.15"
15
15
  },
16
16
  "devDependencies": {
17
- "@ckeditor/ckeditor5-build-classic": "^33.0.0",
18
- "@ckeditor/ckeditor5-editor-classic": "^33.0.0",
19
- "@ckeditor/ckeditor5-core": "^33.0.0",
20
- "@ckeditor/ckeditor5-engine": "^33.0.0"
17
+ "@ckeditor/ckeditor5-build-classic": "^34.2.0",
18
+ "@ckeditor/ckeditor5-editor-classic": "^34.2.0",
19
+ "@ckeditor/ckeditor5-core": "^34.2.0",
20
+ "@ckeditor/ckeditor5-engine": "^34.2.0"
21
21
  },
22
22
  "engines": {
23
23
  "node": ">=14.0.0",
@@ -12,8 +12,7 @@
12
12
  /**
13
13
  * URL to the documentation with error codes.
14
14
  */
15
- export const DOCUMENTATION_URL =
16
- 'https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/error-codes.html';
15
+ export const DOCUMENTATION_URL = 'https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html';
17
16
 
18
17
  /**
19
18
  * The CKEditor error class.
@@ -10,6 +10,7 @@
10
10
  import EventInfo from './eventinfo';
11
11
  import uid from './uid';
12
12
  import priorities from './priorities';
13
+ import insertToPriorityArray from './inserttopriorityarray';
13
14
 
14
15
  // To check if component is loaded more than once.
15
16
  import './version';
@@ -298,21 +299,7 @@ const EmitterMixin = {
298
299
  // Add the callback to all callbacks list.
299
300
  for ( const callbacks of lists ) {
300
301
  // Add the callback to the list in the right priority position.
301
- let added = false;
302
-
303
- for ( let i = 0; i < callbacks.length; i++ ) {
304
- if ( callbacks[ i ].priority < priority ) {
305
- callbacks.splice( i, 0, callbackDefinition );
306
- added = true;
307
-
308
- break;
309
- }
310
- }
311
-
312
- // Add at the end, if right place was not found.
313
- if ( !added ) {
314
- callbacks.push( callbackDefinition );
315
- }
302
+ insertToPriorityArray( callbacks, callbackDefinition );
316
303
  }
317
304
  },
318
305
 
package/src/index.js CHANGED
@@ -27,6 +27,7 @@ export { default as ResizeObserver } from './dom/resizeobserver';
27
27
  export { default as setDataInElement } from './dom/setdatainelement';
28
28
  export { default as toUnit } from './dom/tounit';
29
29
  export { default as isVisible } from './dom/isvisible';
30
+ export * from './dom/scroll';
30
31
 
31
32
  export * from './keyboard';
32
33
  export * from './language';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ import priorities from './priorities';
7
+
8
+ /**
9
+ * @module utils/inserttopriorityarray
10
+ */
11
+
12
+ /**
13
+ * The priority object descriptor.
14
+ *
15
+ * const objectWithPriority = {
16
+ * priority: 'high'
17
+ * }
18
+ *
19
+ * @typedef {Object} module:utils/inserttopriorityarray~ObjectWithPriority
20
+ *
21
+ * @property {module:utils/priorities~PriorityString|Number} priority Priority of the object.
22
+ */
23
+
24
+ /**
25
+ * Inserts any object with priority at correct index by priority so registered objects are always sorted from highest to lowest priority.
26
+ *
27
+ * @param {Array.<module:utils/inserttopriorityarray~ObjectWithPriority>} objects Array of objects with priority to insert object to.
28
+ * @param {module:utils/inserttopriorityarray~ObjectWithPriority} objectToInsert Object with `priority` property.
29
+ */
30
+ export default function insertToPriorityArray( objects, objectToInsert ) {
31
+ const priority = priorities.get( objectToInsert.priority );
32
+
33
+ for ( let i = 0; i < objects.length; i++ ) {
34
+ if ( priorities.get( objects[ i ].priority ) < priority ) {
35
+ objects.splice( i, 0, objectToInsert );
36
+
37
+ return;
38
+ }
39
+ }
40
+
41
+ objects.push( objectToInsert );
42
+ }
package/src/version.js CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
  import CKEditorError from './ckeditorerror';
13
13
 
14
- const version = '33.0.0';
14
+ const version = '34.2.0';
15
15
 
16
16
  export default version;
17
17
 
@@ -49,14 +49,14 @@ if ( windowOrGlobal.CKEDITOR_VERSION ) {
49
49
  * Adding plugins to a build is done by taking the source version of this build (so, before it was built with webpack)
50
50
  * and adding plugins there. In this situation, webpack will know that it only needs to load each plugin once.
51
51
  *
52
- * Read more in the {@glink builds/guides/integration/installing-plugins "Installing plugins"} guide.
52
+ * Read more in the {@glink installation/getting-started/installing-plugins "Installing plugins"} guide.
53
53
  *
54
54
  * # Confused an editor build with an editor implementation
55
55
  *
56
56
  * This scenario is very similar to the previous one, but has a different origin.
57
57
  *
58
58
  * Let's assume that you wanted to use CKEditor 5 from source, as explained in the
59
- * {@glink builds/guides/integration/advanced-setup#scenario-2-building-from-source "Building from source"} section
59
+ * {@glink installation/advanced/alternative-setups/integrating-from-source "Building from source"} section
60
60
  * or in the {@glink framework/guides/quick-start "Quick start"} guide of CKEditor 5 Framework.
61
61
  *
62
62
  * The correct way to do so is to import an editor and plugins and run them together like this:
@@ -98,7 +98,7 @@ if ( windowOrGlobal.CKEDITOR_VERSION ) {
98
98
  * Check your web page for duplicated `<script>` elements or make sure your page builder/bundler includes CKEditor only once.
99
99
  *
100
100
  * If you want to use two different types of editors at once, see the
101
- * {@glink builds/guides/integration/advanced-setup#scenario-3-using-two-different-editors "Using two different editors"}
101
+ * {@glink installation/advanced/using-two-editors "Using two different editors"}
102
102
  * section.
103
103
  *
104
104
  * # Using outdated packages
@@ -124,7 +124,7 @@ if ( windowOrGlobal.CKEDITOR_VERSION ) {
124
124
  * **Note:** All official CKEditor 5 packages (excluding integrations and `ckeditor5-dev-*` packages) are released in the
125
125
  * same major version. This is &mdash; in the `x.y.z`, the `x` is the same for all packages. This is the simplest way to check
126
126
  * whether you use packages coming from the same CKEditor 5 version. You can read more about versioning in the
127
- * {@glink framework/guides/support/versioning-policy Versioning policy} guide.
127
+ * {@glink support/versioning-policy Versioning policy} guide.
128
128
  *
129
129
  * # Packages were duplicated in `node_modules`
130
130
  *