@ckeditor/ckeditor5-utils
Advanced tools
Comparing version 22.0.0 to 23.0.0
{ | ||
"name": "@ckeditor/ckeditor5-utils", | ||
"version": "22.0.0", | ||
"version": "23.0.0", | ||
"description": "Miscellaneous utils used by CKEditor 5.", | ||
@@ -15,6 +15,6 @@ "keywords": [ | ||
"devDependencies": { | ||
"@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", | ||
"@ckeditor/ckeditor5-build-classic": "^23.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^23.0.0", | ||
"@ckeditor/ckeditor5-core": "^23.0.0", | ||
"@ckeditor/ckeditor5-engine": "^23.0.0", | ||
"assertion-error": "^1.1.0", | ||
@@ -21,0 +21,0 @@ "js-beautify": "^1.11.0" |
@@ -36,3 +36,3 @@ /** | ||
* * / | ||
* throw new CKEditorError( 'plugin-load: It was not possible to load the "{$pluginName}" plugin in module "{$moduleName}', { | ||
* throw new CKEditorError( 'plugin-load', { | ||
* pluginName: 'foo', | ||
@@ -48,5 +48,4 @@ * moduleName: 'bar' | ||
* | ||
* @param {String} message The error message in an `error-name: Error message.` format. | ||
* During the minification process the "Error message" part will be removed to limit the code size | ||
* and a link to this error documentation will be added to the `message`. | ||
* @param {String} errorName The error id in an `error-name` format. A link to this error documentation page will be added | ||
* to the thrown error's `message`. | ||
* @param {Object|null} context A context of the error by which the {@link module:watchdog/watchdog~Watchdog watchdog} | ||
@@ -61,4 +60,4 @@ * is able to determine which editor crashed. It should be an editor instance or a property connected to it. It can be also | ||
*/ | ||
constructor( message, context, data ) { | ||
message = attachLinkToDocumentation( message ); | ||
constructor( errorName, context, data ) { | ||
let message = attachLinkToDocumentation( errorName ); | ||
@@ -142,16 +141,9 @@ if ( data ) { | ||
* * / | ||
* console.warn( attachLinkToDocumentation( | ||
* 'toolbarview-item-unavailable: The requested toolbar item is unavailable.' ), { name } ); | ||
* console.warn( attachLinkToDocumentation( 'toolbarview-item-unavailable' ), { name } ); | ||
* | ||
* @param {String} message Message to be logged. | ||
* @param {String} errorName Error name to be linked. | ||
* @returns {String} | ||
*/ | ||
export function attachLinkToDocumentation( message ) { | ||
const matchedErrorName = message.match( /^([^:]+):/ ); | ||
if ( !matchedErrorName ) { | ||
return message; | ||
} | ||
return message + ` Read more: ${ DOCUMENTATION_URL }#error-${ matchedErrorName[ 1 ] }\n`; | ||
export function attachLinkToDocumentation( errorName ) { | ||
return errorName + ` Read more: ${ DOCUMENTATION_URL }#error-${ errorName }\n`; | ||
} |
@@ -205,7 +205,7 @@ /** | ||
* 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. | ||
* is invalid. It must be a number between 0 and the collection's length. | ||
* | ||
* @error collection-add-item-bad-index | ||
* @error collection-add-item-invalid-index | ||
*/ | ||
throw new CKEditorError( 'collection-add-item-invalid-index: The index passed to Collection#addMany() is invalid.', this ); | ||
throw new CKEditorError( 'collection-add-item-invalid-index', this ); | ||
} | ||
@@ -234,5 +234,5 @@ | ||
/** | ||
* Gets item by its id or index. | ||
* Gets an item by its ID or index. | ||
* | ||
* @param {String|Number} idOrIndex The item id or index in the collection. | ||
* @param {String|Number} idOrIndex The item ID or index in the collection. | ||
* @returns {Object|null} The requested item or `null` if such item does not exist. | ||
@@ -249,7 +249,7 @@ */ | ||
/** | ||
* Index or id must be given. | ||
* An index or ID must be given. | ||
* | ||
* @error collection-get-invalid-arg | ||
*/ | ||
throw new CKEditorError( 'collection-get-invalid-arg: Index or id must be given.', this ); | ||
throw new CKEditorError( 'collection-get-invalid-arg', this ); | ||
} | ||
@@ -261,5 +261,5 @@ | ||
/** | ||
* Returns a boolean indicating whether the collection contains an item. | ||
* Returns a Boolean indicating whether the collection contains an item. | ||
* | ||
* @param {Object|String} itemOrId The item or its id in the collection. | ||
* @param {Object|String} itemOrId The item or its ID in the collection. | ||
* @returns {Boolean} `true` if the collection contains the item, `false` otherwise. | ||
@@ -279,7 +279,7 @@ */ | ||
/** | ||
* Gets index of item in the collection. | ||
* When item is not defined in the collection then index will be equal -1. | ||
* Gets an index of an item in the collection. | ||
* When an item is not defined in the collection, the index will equal -1. | ||
* | ||
* @param {Object|String} itemOrId The item or its id in the collection. | ||
* @returns {Number} Index of given item. | ||
* @param {Object|String} itemOrId The item or its ID in the collection. | ||
* @returns {Number} The index of a given item. | ||
*/ | ||
@@ -301,3 +301,3 @@ getIndex( itemOrId ) { | ||
* | ||
* @param {Object|Number|String} subject The item to remove, its id or index in the collection. | ||
* @param {Object|Number|String} subject The item to remove, its ID or index in the collection. | ||
* @returns {Object} The removed item. | ||
@@ -488,3 +488,3 @@ * @fires remove | ||
*/ | ||
throw new CKEditorError( 'collection-bind-to-rebind: The collection cannot be bound more than once.', this ); | ||
throw new CKEditorError( 'collection-bind-to-rebind', this ); | ||
} | ||
@@ -652,7 +652,7 @@ | ||
/** | ||
* This item's id should be a string. | ||
* This item's ID should be a string. | ||
* | ||
* @error collection-add-invalid-id | ||
*/ | ||
throw new CKEditorError( 'collection-add-invalid-id: This item\'s id should be a string.', this ); | ||
throw new CKEditorError( 'collection-add-invalid-id', this ); | ||
} | ||
@@ -666,3 +666,3 @@ | ||
*/ | ||
throw new CKEditorError( 'collection-add-item-already-exists: This item already exists in the collection.', this ); | ||
throw new CKEditorError( 'collection-add-item-already-exists', this ); | ||
} | ||
@@ -720,3 +720,3 @@ } else { | ||
*/ | ||
throw new CKEditorError( 'collection-remove-404: Item not found.', this ); | ||
throw new CKEditorError( 'collection-remove-404', this ); | ||
} | ||
@@ -723,0 +723,0 @@ |
@@ -53,2 +53,10 @@ /** | ||
/** | ||
* Indicates that the application is running in a browser using the Blink engine. | ||
* | ||
* @static | ||
* @type {Boolean} | ||
*/ | ||
isBlink: isBlink( userAgent ), | ||
/** | ||
* Environment features information. | ||
@@ -114,2 +122,14 @@ * | ||
/** | ||
* Checks if User Agent represented by the string is Blink engine. | ||
* | ||
* @param {String} userAgent **Lowercase** `navigator.userAgent` string. | ||
* @returns {Boolean} Whether User Agent is Blink engine or not. | ||
*/ | ||
export function isBlink( userAgent ) { | ||
// The Edge browser before switching to the Blink engine used to report itself as Chrome (and "Edge/") | ||
// but after switching to the Blink it replaced "Edge/" with "Edg/". | ||
return userAgent.indexOf( 'chrome/' ) > -1 && userAgent.indexOf( 'edge/' ) < 0; | ||
} | ||
/** | ||
* Checks if the current environment supports ES2018 Unicode properties like `\p{P}` or `\p{L}`. | ||
@@ -116,0 +136,0 @@ * More information about unicode properties might be found |
@@ -83,5 +83,5 @@ /** | ||
* | ||
* @error focusTracker-add-element-already-exist | ||
* @error focustracker-add-element-already-exist | ||
*/ | ||
throw new CKEditorError( 'focusTracker-add-element-already-exist: This element is already tracked by FocusTracker.', this ); | ||
throw new CKEditorError( 'focustracker-add-element-already-exist', this ); | ||
} | ||
@@ -88,0 +88,0 @@ |
@@ -60,9 +60,6 @@ /** | ||
* | ||
* @errror keyboard-unknown-key | ||
* @error keyboard-unknown-key | ||
* @param {String} key | ||
*/ | ||
throw new CKEditorError( | ||
'keyboard-unknown-key: Unknown key name.', | ||
null, { key } | ||
); | ||
throw new CKEditorError( 'keyboard-unknown-key', null, { key } ); | ||
} | ||
@@ -69,0 +66,0 @@ } else { |
@@ -19,3 +19,3 @@ /** | ||
/** | ||
* Mixin that injects the "observable properties" and data binding functionality described in the | ||
* A mixin that injects the "observable properties" and data binding functionality described in the | ||
* {@link ~Observable} interface. | ||
@@ -54,3 +54,3 @@ * | ||
* | ||
* This error is thrown when trying to {@link ~Observable#set set} an property with | ||
* This error is thrown when trying to {@link ~Observable#set set} a property with | ||
* a name of an already existing property. For example: | ||
@@ -67,3 +67,3 @@ * | ||
*/ | ||
throw new CKEditorError( 'observable-set-cannot-override: Cannot override an existing property.', this ); | ||
throw new CKEditorError( 'observable-set-cannot-override', this ); | ||
} | ||
@@ -113,3 +113,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-wrong-properties: All properties must be strings.', this ); | ||
throw new CKEditorError( 'observable-bind-wrong-properties', this ); | ||
} | ||
@@ -123,3 +123,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-duplicate-properties: Properties must be unique.', this ); | ||
throw new CKEditorError( 'observable-bind-duplicate-properties', this ); | ||
} | ||
@@ -138,3 +138,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-rebind: Cannot bind the same property more than once.', this ); | ||
throw new CKEditorError( 'observable-bind-rebind', this ); | ||
} | ||
@@ -195,3 +195,3 @@ } ); | ||
*/ | ||
throw new CKEditorError( 'observable-unbind-wrong-properties: Properties must be strings.', this ); | ||
throw new CKEditorError( 'observable-unbind-wrong-properties', this ); | ||
} | ||
@@ -255,3 +255,3 @@ | ||
throw new CKEditorError( | ||
'observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.', | ||
'observablemixin-cannot-decorate-undefined', | ||
this, | ||
@@ -276,3 +276,3 @@ { object: this, methodName } | ||
// Init symbol properties needed to for the observable mechanism to work. | ||
// Init symbol properties needed for the observable mechanism to work. | ||
// | ||
@@ -392,8 +392,5 @@ // @private | ||
* | ||
* @error observable-bind-no-callback | ||
* @error observable-bind-to-no-callback | ||
*/ | ||
throw new CKEditorError( | ||
'observable-bind-to-no-callback: Binding multiple observables only possible with callback.', | ||
this | ||
); | ||
throw new CKEditorError( 'observable-bind-to-no-callback', this ); | ||
} | ||
@@ -409,3 +406,3 @@ | ||
throw new CKEditorError( | ||
'observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.', | ||
'observable-bind-to-extra-callback', | ||
this | ||
@@ -423,3 +420,3 @@ ); | ||
*/ | ||
throw new CKEditorError( 'observable-bind-to-properties-length: The number of properties must match.', this ); | ||
throw new CKEditorError( 'observable-bind-to-properties-length', this ); | ||
} | ||
@@ -465,3 +462,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().', this ); | ||
throw new CKEditorError( 'observable-bind-to-many-not-one-binding', this ); | ||
} | ||
@@ -525,3 +522,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-to-parse-error: Invalid argument syntax in `to()`.', null ); | ||
throw new CKEditorError( 'observable-bind-to-parse-error', null ); | ||
} | ||
@@ -543,3 +540,3 @@ | ||
} else { | ||
throw new CKEditorError( 'observable-bind-to-parse-error: Invalid argument syntax in `to()`.', null ); | ||
throw new CKEditorError( 'observable-bind-to-parse-error', null ); | ||
} | ||
@@ -688,3 +685,3 @@ } ); | ||
/** | ||
* Interface which adds "observable properties" and data binding functionality. | ||
* An interface which adds "observable properties" and data binding functionality. | ||
* | ||
@@ -743,3 +740,3 @@ * Can be easily implemented by a class by mixing the {@link module:utils/observablemixin~ObservableMixin} mixin. | ||
* | ||
* **Note:** Event is fired even when the new value is the same as the old value. | ||
* **Note:** The event is fired even when the new value is the same as the old value. | ||
* | ||
@@ -753,4 +750,4 @@ * @event set:{property} | ||
/** | ||
* Creates and sets the value of an observable property of this object. Such an property becomes a part | ||
* of the state and is be observable. | ||
* Creates and sets the value of an observable property of this object. Such a property becomes a part | ||
* of the state and is observable. | ||
* | ||
@@ -760,3 +757,3 @@ * It accepts also a single object literal containing key/value pairs with properties to be set. | ||
* This method throws the `observable-set-cannot-override` error if the observable instance already | ||
* have a property with the given property name. This prevents from mistakenly overriding existing | ||
* has a property with the given property name. This prevents from mistakenly overriding existing | ||
* properties and methods, but means that `foo.set( 'bar', 1 )` may be slightly slower than `foo.bar = 1`. | ||
@@ -763,0 +760,0 @@ * |
@@ -147,3 +147,3 @@ /** | ||
*/ | ||
throw new CKEditorError( 'translation-service-quantity-not-a-number: Expecting `quantity` to be a number.', null, { quantity } ); | ||
throw new CKEditorError( 'translation-service-quantity-not-a-number', null, { quantity } ); | ||
} | ||
@@ -150,0 +150,0 @@ |
@@ -14,3 +14,3 @@ /** | ||
const version = '22.0.0'; | ||
const version = '23.0.0'; | ||
@@ -151,3 +151,3 @@ /* istanbul ignore next */ | ||
throw new CKEditorError( | ||
'ckeditor-duplicated-modules: Some CKEditor 5 modules are duplicated.', | ||
'ckeditor-duplicated-modules', | ||
null | ||
@@ -154,0 +154,0 @@ ); |
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
6531
267586