@ckeditor/ckeditor5-utils
Advanced tools
Comparing version 12.1.1 to 13.0.0
Changelog | ||
========= | ||
## [13.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v12.1.1...v13.0.0) (2019-07-04) | ||
### Features | ||
* Added `env.isAndroid`. ([591f641](https://github.com/ckeditor/ckeditor5-utils/commit/591f641)) | ||
### Other changes | ||
* Added context as second required argument to the `CKEditorError`'s constructor, changed `isCKEditorError()` method to `is()`. Introduced the `areConnectedThroughProperties()` utility. See [ckeditor/ckeditor5-watchdog#1](https://github.com/ckeditor/ckeditor5-watchdog/issues/1). ([bacc764](https://github.com/ckeditor/ckeditor5-utils/commit/bacc764)) | ||
### BREAKING CHANGES | ||
* The list of `CKEditorError()`'s parameters was changed – now it requires the message, context and then data. The `isCKEditorError()` method was renamed to `is()`. | ||
## [12.1.1](https://github.com/ckeditor/ckeditor5-utils/compare/v12.1.0...v12.1.1) (2019-06-05) | ||
@@ -5,0 +20,0 @@ |
{ | ||
"name": "@ckeditor/ckeditor5-utils", | ||
"version": "12.1.1", | ||
"version": "13.0.0", | ||
"description": "Miscellaneous utils used by CKEditor 5.", | ||
@@ -12,9 +12,9 @@ "keywords": [ | ||
"dependencies": { | ||
"ckeditor5": "^12.2.0", | ||
"ckeditor5": "^12.3.0", | ||
"lodash-es": "^4.17.10" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-build-classic": "^12.2.0", | ||
"@ckeditor/ckeditor5-core": "^12.1.1", | ||
"@ckeditor/ckeditor5-engine": "^13.1.1", | ||
"@ckeditor/ckeditor5-build-classic": "^12.3.0", | ||
"@ckeditor/ckeditor5-core": "^12.2.0", | ||
"@ckeditor/ckeditor5-engine": "^13.2.0", | ||
"eslint": "^5.5.0", | ||
@@ -21,0 +21,0 @@ "eslint-config-ckeditor5": "^1.0.11", |
@@ -7,3 +7,2 @@ CKEditor 5 utilities | ||
[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-utils.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-utils) | ||
[![BrowserStack Status](https://automate.browserstack.com/automate/badge.svg?badge_key=d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0)](https://automate.browserstack.com/public-build/d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0) | ||
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5-utils/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5-utils?branch=master) | ||
@@ -10,0 +9,0 @@ <br> |
@@ -35,2 +35,7 @@ /** | ||
* and a link to this error documentation will be added to the `message`. | ||
* @param {Object|null} context A context of the error by which the {@link module:watchdog/watchdog~Watchdog watchdog} | ||
* is able to determine which editor crashed. It should be an editor instance or a property connected to it. It can be also | ||
* a `null` value if the editor should not be restarted in case of the error (e.g. during the editor initialization). | ||
* The error context should be checked using the `areConnectedThroughProperties( editor, context )` utility | ||
* to check if the object works as the context. | ||
* @param {Object} [data] Additional data describing the error. A stringified version of this object | ||
@@ -40,3 +45,3 @@ * will be appended to the error message, so the data are quickly visible in the console. The original | ||
*/ | ||
constructor( message, data ) { | ||
constructor( message, context, data ) { | ||
message = attachLinkToDocumentation( message ); | ||
@@ -51,3 +56,3 @@ | ||
/** | ||
* @member {String} | ||
* @type {String} | ||
*/ | ||
@@ -57,5 +62,12 @@ this.name = 'CKEditorError'; | ||
/** | ||
* A context of the error by which the Watchdog is able to determine which editor crashed. | ||
* | ||
* @type {Object|null} | ||
*/ | ||
this.context = context; | ||
/** | ||
* The additional error data passed to the constructor. Undefined if none was passed. | ||
* | ||
* @member {Object|undefined} | ||
* @type {Object|undefined} | ||
*/ | ||
@@ -66,9 +78,6 @@ this.data = data; | ||
/** | ||
* Checks if error is an instance of CKEditorError class. | ||
* | ||
* @param {Object} error Object to check. | ||
* @returns {Boolean} | ||
* Checks if the error is of the `CKEditorError` type. | ||
*/ | ||
static isCKEditorError( error ) { | ||
return error instanceof CKEditorError; | ||
is( type ) { | ||
return type === 'CKEditorError'; | ||
} | ||
@@ -75,0 +84,0 @@ } |
@@ -151,3 +151,3 @@ /** | ||
*/ | ||
throw new CKEditorError( 'collection-add-invalid-id' ); | ||
throw new CKEditorError( 'collection-add-invalid-id', this ); | ||
} | ||
@@ -161,3 +161,3 @@ | ||
*/ | ||
throw new CKEditorError( 'collection-add-item-already-exists' ); | ||
throw new CKEditorError( 'collection-add-item-already-exists', this ); | ||
} | ||
@@ -177,3 +177,3 @@ } else { | ||
*/ | ||
throw new CKEditorError( 'collection-add-item-invalid-index' ); | ||
throw new CKEditorError( 'collection-add-item-invalid-index', this ); | ||
} | ||
@@ -209,3 +209,3 @@ | ||
*/ | ||
throw new CKEditorError( 'collection-get-invalid-arg: Index or id must be given.' ); | ||
throw new CKEditorError( 'collection-get-invalid-arg: Index or id must be given.', this ); | ||
} | ||
@@ -293,3 +293,3 @@ | ||
*/ | ||
throw new CKEditorError( 'collection-remove-404: Item not found.' ); | ||
throw new CKEditorError( 'collection-remove-404: Item not found.', this ); | ||
} | ||
@@ -467,3 +467,3 @@ | ||
*/ | ||
throw new CKEditorError( 'collection-bind-to-rebind: The collection cannot be bound more than once.' ); | ||
throw new CKEditorError( 'collection-bind-to-rebind: The collection cannot be bound more than once.', this ); | ||
} | ||
@@ -470,0 +470,0 @@ |
@@ -50,3 +50,11 @@ /** | ||
*/ | ||
isSafari: isSafari( userAgent ) | ||
isSafari: isSafari( userAgent ), | ||
/** | ||
* Indicates that the application is running on Android mobile device. | ||
* | ||
* @static | ||
* @type {Boolean} | ||
*/ | ||
isAndroid: isAndroid( userAgent ) | ||
}; | ||
@@ -95,1 +103,11 @@ | ||
} | ||
/** | ||
* Checks if User Agent represented by the string is Android mobile device. | ||
* | ||
* @param {String} userAgent **Lowercase** `navigator.userAgent` string. | ||
* @returns {Boolean} Whether User Agent is Safari or not. | ||
*/ | ||
export function isAndroid( userAgent ) { | ||
return userAgent.indexOf( 'android' ) > -1; | ||
} |
@@ -78,3 +78,3 @@ /** | ||
if ( this._elements.has( element ) ) { | ||
throw new CKEditorError( 'focusTracker-add-element-already-exist' ); | ||
throw new CKEditorError( 'focusTracker-add-element-already-exist', this ); | ||
} | ||
@@ -81,0 +81,0 @@ |
@@ -63,3 +63,6 @@ /** | ||
*/ | ||
throw new CKEditorError( 'keyboard-unknown-key: Unknown key name.', { key } ); | ||
throw new CKEditorError( | ||
'keyboard-unknown-key: Unknown key name.', | ||
null, { key } | ||
); | ||
} | ||
@@ -66,0 +69,0 @@ } else { |
@@ -65,3 +65,3 @@ /** | ||
*/ | ||
throw new CKEditorError( 'observable-set-cannot-override: Cannot override an existing property.' ); | ||
throw new CKEditorError( 'observable-set-cannot-override: Cannot override an existing property.', this ); | ||
} | ||
@@ -111,3 +111,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-wrong-properties: All properties must be strings.' ); | ||
throw new CKEditorError( 'observable-bind-wrong-properties: All properties must be strings.', this ); | ||
} | ||
@@ -121,3 +121,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-duplicate-properties: Properties must be unique.' ); | ||
throw new CKEditorError( 'observable-bind-duplicate-properties: Properties must be unique.', this ); | ||
} | ||
@@ -136,3 +136,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-rebind: Cannot bind the same property more that once.' ); | ||
throw new CKEditorError( 'observable-bind-rebind: Cannot bind the same property more that once.', this ); | ||
} | ||
@@ -193,3 +193,3 @@ } ); | ||
*/ | ||
throw new CKEditorError( 'observable-unbind-wrong-properties: Properties must be strings.' ); | ||
throw new CKEditorError( 'observable-unbind-wrong-properties: Properties must be strings.', this ); | ||
} | ||
@@ -254,2 +254,3 @@ | ||
'observablemixin-cannot-decorate-undefined: Cannot decorate an undefined method.', | ||
this, | ||
{ object: this, methodName } | ||
@@ -389,3 +390,6 @@ ); | ||
*/ | ||
throw new CKEditorError( 'observable-bind-to-no-callback: Binding multiple observables only possible with callback.' ); | ||
throw new CKEditorError( | ||
'observable-bind-to-no-callback: Binding multiple observables only possible with callback.', | ||
this | ||
); | ||
} | ||
@@ -400,3 +404,6 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.' ); | ||
throw new CKEditorError( | ||
'observable-bind-to-extra-callback: Cannot bind multiple properties and use a callback in one binding.', | ||
this | ||
); | ||
} | ||
@@ -412,3 +419,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-to-properties-length: The number of properties must match.' ); | ||
throw new CKEditorError( 'observable-bind-to-properties-length: The number of properties must match.', this ); | ||
} | ||
@@ -454,3 +461,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().' ); | ||
throw new CKEditorError( 'observable-bind-to-many-not-one-binding: Cannot bind multiple properties with toMany().', this ); | ||
} | ||
@@ -514,3 +521,3 @@ | ||
*/ | ||
throw new CKEditorError( 'observable-bind-to-parse-error: Invalid argument syntax in `to()`.' ); | ||
throw new CKEditorError( 'observable-bind-to-parse-error: Invalid argument syntax in `to()`.', null ); | ||
} | ||
@@ -532,3 +539,3 @@ | ||
} else { | ||
throw new CKEditorError( 'observable-bind-to-parse-error: Invalid argument syntax in `to()`.' ); | ||
throw new CKEditorError( 'observable-bind-to-parse-error: Invalid argument syntax in `to()`.', null ); | ||
} | ||
@@ -535,0 +542,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
220115
56
5600
21
Updatedckeditor5@^12.3.0