@ckeditor/ckeditor5-utils
Advanced tools
Comparing version 11.0.0 to 11.1.0
Changelog | ||
========= | ||
## [11.1.0](https://github.com/ckeditor/ckeditor5-utils/compare/v11.0.0...v11.1.0) (2018-12-05) | ||
### Features | ||
* Implemented `env#isGecko()`. See [ckeditor/ckeditor5-engine#1439](https://github.com/ckeditor/ckeditor5-engine/issues/1439). ([53b7c94](https://github.com/ckeditor/ckeditor5-utils/commit/53b7c94)) | ||
### Other changes | ||
* Vairous fixes in the API docs. Thanks to [@denisname](https://github.com/denisname)! | ||
## [11.0.0](https://github.com/ckeditor/ckeditor5-utils/compare/v10.2.1...v11.0.0) (2018-10-08) | ||
@@ -5,0 +16,0 @@ |
{ | ||
"name": "@ckeditor/ckeditor5-utils", | ||
"version": "11.0.0", | ||
"version": "11.1.0", | ||
"description": "Miscellaneous utils used by CKEditor 5.", | ||
@@ -12,8 +12,8 @@ "keywords": [ | ||
"dependencies": { | ||
"ckeditor5": "^11.1.0", | ||
"ckeditor5": "^11.2.0", | ||
"lodash-es": "^4.17.10" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-core": "^11.0.1", | ||
"@ckeditor/ckeditor5-engine": "^11.0.0", | ||
"@ckeditor/ckeditor5-core": "^11.1.0", | ||
"@ckeditor/ckeditor5-engine": "^12.0.0", | ||
"del": "^2.2.0", | ||
@@ -23,4 +23,3 @@ "eslint": "^5.5.0", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^7.0.0", | ||
"lodash-cli": "^4" | ||
"lint-staged": "^7.0.0" | ||
}, | ||
@@ -27,0 +26,0 @@ "engines": { |
@@ -54,5 +54,5 @@ /** | ||
/** | ||
* The additional error data passed to the constructor. | ||
* The additional error data passed to the constructor. Undefined if none was passed. | ||
* | ||
* @member {Object} | ||
* @member {Object|undefined} | ||
*/ | ||
@@ -59,0 +59,0 @@ this.data = data; |
@@ -293,3 +293,3 @@ /** | ||
* @param {Number} callback.index | ||
* @params {Object} ctx Context in which the `callback` will be called. | ||
* @param {Object} ctx Context in which the `callback` will be called. | ||
* @returns {Array} The result of mapping. | ||
@@ -307,4 +307,4 @@ */ | ||
* @param {Number} callback.index | ||
* @param {Object} ctx Context in which the `callback` will be called. | ||
* @returns {Object} The item for which `callback` returned a true value. | ||
* @params {Object} ctx Context in which the `callback` will be called. | ||
*/ | ||
@@ -321,3 +321,3 @@ find( callback, ctx ) { | ||
* @param {Number} callback.index | ||
* @params {Object} ctx Context in which the `callback` will be called. | ||
* @param {Object} ctx Context in which the `callback` will be called. | ||
* @returns {Object[]} The array with matching items. | ||
@@ -324,0 +324,0 @@ */ |
@@ -23,4 +23,4 @@ /** | ||
* @param {String} name Name of the element. | ||
* @param {Object} attributes Object keys will become attributes keys and object values will became attributes values. | ||
* @param {Node|String|Array.<Node|String>} children Child or array of children. Strings will be automatically turned | ||
* @param {Object} [attributes] Object keys will become attributes keys and object values will became attributes values. | ||
* @param {Node|String|Array.<Node|String>} [children] Child or array of children. Strings will be automatically turned | ||
* into Text nodes. | ||
@@ -27,0 +27,0 @@ * @returns {Element} Created element. |
@@ -14,3 +14,3 @@ /** | ||
* @param {HTMLElement} element An element which has CSS borders. | ||
* @param {Object} An object containing `top`, `left`, `right` and `bottom` properties | ||
* @returns {Object} An object containing `top`, `left`, `right` and `bottom` properties | ||
* with numerical values of the `border-[top,left,right,bottom]-width` CSS styles. | ||
@@ -17,0 +17,0 @@ */ |
@@ -15,3 +15,3 @@ /** | ||
* | ||
* @param {HTMLElement} element Native DOM element to be checked. | ||
* @param {HTMLElement} element The native DOM element to be checked. | ||
* @returns {HTMLElement|null} | ||
@@ -18,0 +18,0 @@ */ |
@@ -70,3 +70,3 @@ /** | ||
* // to set proper class on the `element`. | ||
* console.log( name ); -> "myNorthEastPosition" | ||
* console.log( name ); // -> "myNorthEastPosition" | ||
* | ||
@@ -73,0 +73,0 @@ * // Using the absolute coordinates which has been found to position the element |
@@ -638,3 +638,3 @@ /** | ||
* @param {module:utils/emittermixin~Emitter} emitter An `EmitterMixin` instance which is the destination for delegated events. | ||
* @param {String|Function} nameOrFunction A custom event name or function which converts the original name string. | ||
* @param {String|Function} [nameOrFunction] A custom event name or function which converts the original name string. | ||
*/ |
@@ -34,3 +34,11 @@ /** | ||
*/ | ||
isEdge: isEdge( userAgent ) | ||
isEdge: isEdge( userAgent ), | ||
/** | ||
* Indicates that the application is running in Firefox (Gecko). | ||
* | ||
* @static | ||
* @member {Boolean} module:utils/env~env#isEdge | ||
*/ | ||
isGecko: isGecko( userAgent ) | ||
}; | ||
@@ -59,1 +67,11 @@ | ||
} | ||
/** | ||
* Checks if User Agent represented by the string is Firefox (Gecko). | ||
* | ||
* @param {String} userAgent **Lowercase** `navigator.userAgent` string. | ||
* @returns {Boolean} Whether User Agent is Firefox or not. | ||
*/ | ||
export function isGecko( userAgent ) { | ||
return !!userAgent.match( /gecko\/\d+/ ); | ||
} |
@@ -85,3 +85,3 @@ /** | ||
* {@link module:engine/view/observer/keyobserver~KeyEventData key event data} object and | ||
* a helper to both `preventDefault` and `stopPropagation` of the event. | ||
* a helper funcion to call both `preventDefault()` and `stopPropagation()` on the underlying event. | ||
* @param {Object} [options={}] Additional options. | ||
@@ -88,0 +88,0 @@ * @param {module:utils/priorities~PriorityString|Number} [options.priority='normal'] The priority of the keystroke |
@@ -47,3 +47,3 @@ /** | ||
* @param {String} str The string to translate. | ||
* @param {String[]} values Values that should be used to interpolate the string. | ||
* @param {String[]} [values] Values that should be used to interpolate the string. | ||
*/ | ||
@@ -50,0 +50,0 @@ this.t = ( ...args ) => this._t( ...args ); |
@@ -13,2 +13,4 @@ /** | ||
* | ||
* @param {Map} mapA The first map to compare. | ||
* @param {Map} mapB The second map to compare. | ||
* @returns {Boolean} `true` if given maps are equal, `false` otherwise. | ||
@@ -15,0 +17,0 @@ */ |
@@ -22,2 +22,7 @@ /** | ||
* | ||
* Read more about the concept of observables in the: | ||
* * {@glink framework/guides/architecture/core-editor-architecture#event-system-and-observables "Event system and observables"} | ||
* section of the {@glink framework/guides/architecture/core-editor-architecture "Core editor architecture"} guide, | ||
* * {@glink framework/guides/deep-dive/observables "Observables" deep dive} guide. | ||
* | ||
* @mixin ObservableMixin | ||
@@ -665,2 +670,7 @@ * @mixes module:utils/emittermixin~EmitterMixin | ||
* | ||
* Read more about the usage of this interface in the: | ||
* * {@glink framework/guides/architecture/core-editor-architecture#event-system-and-observables "Event system and observables"} | ||
* section of the {@glink framework/guides/architecture/core-editor-architecture "Core editor architecture"} guide, | ||
* * {@glink framework/guides/deep-dive/observables "Observables" deep dive} guide. | ||
* | ||
* @interface Observable | ||
@@ -735,23 +745,50 @@ * @extends module:utils/emittermixin~Emitter | ||
/** | ||
* Binds observable properties to another objects implementing {@link module:utils/observablemixin~Observable} | ||
* interface (like {@link module:ui/model~Model}). | ||
* Binds {@link #set obvervable properties} to other objects implementing the | ||
* {@link module:utils/observablemixin~Observable} interface. | ||
* | ||
* Once bound, the observable will immediately share the current state of properties | ||
* of the observable it is bound to and react to the changes to these properties | ||
* in the future. | ||
* Read more in the {@glink framework/guides/deep-dive/observables#property-bindings dedicated guide} | ||
* covering the topic of property bindings with some additional examples. | ||
* | ||
* Let's consider two objects: a `button` and an associated `command` (both `Observable`). | ||
* | ||
* A simple property binding could be as follows: | ||
* | ||
* button.bind( 'isEnabled' ).to( command, 'isEnabled' ); | ||
* | ||
* or even shorter: | ||
* | ||
* button.bind( 'isEnabled' ).to( command ); | ||
* | ||
* which works in the following way: | ||
* | ||
* * `button.isEnabled` **instantly equals** `command.isEnabled`, | ||
* * whenever `command.isEnabled` changes, `button.isEnabled` will immediately reflect its value. | ||
* | ||
* **Note**: To release the binding use {@link module:utils/observablemixin~Observable#unbind}. | ||
* | ||
* Using `bind().to()` chain: | ||
* You can also "rename" the property in the binding by specifying the new name in the `to()` chain: | ||
* | ||
* A.bind( 'a' ).to( B ); | ||
* A.bind( 'a' ).to( B, 'b' ); | ||
* A.bind( 'a', 'b' ).to( B, 'c', 'd' ); | ||
* A.bind( 'a' ).to( B, 'b', C, 'd', ( b, d ) => b + d ); | ||
* button.bind( 'isEnabled' ).to( command, 'isWorking' ); | ||
* | ||
* It is also possible to bind to the same property in a observables collection using `bind().toMany()` chain: | ||
* It is possible to bind more than one property at a time to shorten the code: | ||
* | ||
* A.bind( 'a' ).toMany( [ B, C, D ], 'x', ( a, b, c ) => a + b + c ); | ||
* A.bind( 'a' ).toMany( [ B, C, D ], 'x', ( ...x ) => x.every( x => x ) ); | ||
* button.bind( 'isEnabled', 'value' ).to( command ); | ||
* | ||
* which corresponds to: | ||
* | ||
* button.bind( 'isEnabled' ).to( command ); | ||
* button.bind( 'value' ).to( command ); | ||
* | ||
* The binding can include more than one observable, combining multiple data sources in a custom callback: | ||
* | ||
* button.bind( 'isEnabled' ).to( command, 'isEnabled', ui, 'isVisible', | ||
* ( isCommandEnabled, isUIVisible ) => isCommandEnabled && isUIVisible ); | ||
* | ||
* It is also possible to bind to the same property in an array of observables. | ||
* To bind a `button` to multiple commands (also `Observables`) so that each and every one of them | ||
* must be enabled for the button to become enabled, use the following code: | ||
* | ||
* button.bind( 'isEnabled' ).toMany( [ commandA, commandB, commandC ], 'isEnabled', | ||
* ( isAEnabled, isBEnabled, isCEnabled ) => isAEnabled && isBEnabled && isCEnabled ); | ||
* | ||
* @method #bind | ||
@@ -765,3 +802,6 @@ * @param {...String} bindProperties Observable properties that will be bound to another observable(s). | ||
* | ||
* // Removes the binding for the 'a' property. | ||
* A.unbind( 'a' ); | ||
* | ||
* // Removes bindings for all properties. | ||
* A.unbind(); | ||
@@ -778,6 +818,9 @@ * | ||
* | ||
* This is a very simplified method decoration. Itself it doesn't change the behavior of a method (expect adding the event), | ||
* Read more in the {@glink framework/guides/deep-dive/observables#decorating-object-methods dedicated guide} | ||
* covering the topic of decorating methods with some additional examples. | ||
* | ||
* Decorating the method does not change its behavior (it only adds an event), | ||
* but it allows to modify it later on by listening to the method's event. | ||
* | ||
* For example, in order to cancel the method execution one can stop the event: | ||
* For example, to cancel the method execution the event can be {@link module:utils/eventinfo~EventInfo#stop stopped}: | ||
* | ||
@@ -802,6 +845,7 @@ * class Foo { | ||
* | ||
* Note: we used a high priority listener here to execute this callback before the one which | ||
* calls the original method (which used the default priority). | ||
* **Note**: The high {@link module:utils/priorities~PriorityString priority} listener | ||
* has been used to execute this particular callback before the one which calls the original method | ||
* (which uses the "normal" priority). | ||
* | ||
* It's also possible to change the return value: | ||
* It is also possible to change the returned value: | ||
* | ||
@@ -814,3 +858,3 @@ * foo.on( 'method', ( evt ) => { | ||
* | ||
* Finally, it's possible to access and modify the parameters: | ||
* Finally, it is possible to access and modify the arguments the method is called with: | ||
* | ||
@@ -817,0 +861,0 @@ * method( a, b ) { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
198528
7
5231
0
Updatedckeditor5@^11.2.0