Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-utils

Package Overview
Dependencies
Maintainers
1
Versions
647
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-utils - npm Package Compare versions

Comparing version 23.0.0 to 23.1.0

10

package.json
{
"name": "@ckeditor/ckeditor5-utils",
"version": "23.0.0",
"version": "23.1.0",
"description": "Miscellaneous utils used by CKEditor 5.",

@@ -15,6 +15,6 @@ "keywords": [

"devDependencies": {
"@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",
"@ckeditor/ckeditor5-build-classic": "^23.1.0",
"@ckeditor/ckeditor5-editor-classic": "^23.1.0",
"@ckeditor/ckeditor5-core": "^23.1.0",
"@ckeditor/ckeditor5-engine": "^23.1.0",
"assertion-error": "^1.1.0",

@@ -21,0 +21,0 @@ "js-beautify": "^1.11.0"

@@ -10,2 +10,4 @@ /**

/* globals console */
/**

@@ -26,5 +28,6 @@ * URL to the documentation with error codes.

* feedback to the developer as soon as possible. Keep in mind that for common integration issues which should not
* stop editor initialization (like missing upload adapter, wrong name of a toolbar component) we use `console.warn()` with
* {@link module:utils/ckeditorerror~attachLinkToDocumentation `attachLinkToDocumentation()`}
* to improve developers experience and let them see the working editor as soon as possible.
* stop editor initialization (like missing upload adapter, wrong name of a toolbar component) we use
* {@link module:utils/ckeditorerror~logWarning `logWarning()`} and
* {@link module:utils/ckeditorerror~logError `logError()`}
* to improve developers experience and let them see the a working editor as soon as possible.
*

@@ -61,8 +64,4 @@ * /**

constructor( errorName, context, data ) {
let message = attachLinkToDocumentation( errorName );
const message = `${ errorName }${ ( data ? ` ${ JSON.stringify( data ) }` : '' ) }${ getLinkToDocumentationMessage( errorName ) }`;
if ( data ) {
message += ' ' + JSON.stringify( data );
}
super( message );

@@ -98,7 +97,8 @@

/**
* A utility that ensures the the thrown error is a {@link module:utils/ckeditorerror~CKEditorError} one.
* A utility that ensures that the thrown error is a {@link module:utils/ckeditorerror~CKEditorError} one.
* It is useful when combined with the {@link module:watchdog/watchdog~Watchdog} feature, which can restart the editor in case
* of a {@link module:utils/ckeditorerror~CKEditorError} error.
*
* @param {Error} err An error.
* @static
* @param {Error} err The error to rethrow.
* @param {Object} context An object connected through properties with the editor instance. This context will be used

@@ -132,19 +132,58 @@ * by the watchdog to verify which editor should be restarted.

/**
* Attaches the link to the documentation at the end of the error message. Use whenever you log a warning or error on the
* console. It is also used by {@link module:utils/ckeditorerror~CKEditorError}.
* Logs a warning to the console with a properly formatted message and adds a link to the documentation.
* Use whenever you want to log a warning to the console.
*
* /**
* * There was a problem processing the configuration of the toolbar. The item with the given
* * name does not exist so it was omitted when rendering the toolbar.
* *
* * @error toolbarview-item-unavailable
* * @param {String} name The name of the component.
* * /
* console.warn( attachLinkToDocumentation( 'toolbarview-item-unavailable' ), { name } );
* /**
* * There was a problem processing the configuration of the toolbar. The item with the given
* * name does not exist, so it was omitted when rendering the toolbar.
* *
* * @error toolbarview-item-unavailable
* * @param {String} name The name of the component.
* * /
* logWarning( 'toolbarview-item-unavailable', { name } );
*
* @param {String} errorName Error name to be linked.
* See also {@link module:utils/ckeditorerror~CKEditorError} for an explanation when to throw an error and when to log
* a warning or an error to the console.
*
* @param {String} errorName Error name to be logged.
* @param {Object} [data] Additional data to be logged.
* @returns {String}
*/
export function attachLinkToDocumentation( errorName ) {
return errorName + ` Read more: ${ DOCUMENTATION_URL }#error-${ errorName }\n`;
export function logWarning( errorName, data ) {
console.warn( ...formatConsoleArguments( errorName, data ) );
}
/**
* Logs an error to the console with properly formatted message and adds a link to the documentation.
* Use whenever you want to log a error to the console.
*
* /**
* * There was a problem processing the configuration of the toolbar. The item with the given
* * name does not exist, so it was omitted when rendering the toolbar.
* *
* * @error toolbarview-item-unavailable
* * @param {String} name The name of the component.
* * /
* logError( 'toolbarview-item-unavailable', { name } );
*
* **Note**: In most cases logging a warning using {@link module:utils/ckeditorerror~logWarning} is enough.
*
* See also {@link module:utils/ckeditorerror~CKEditorError} for an explanation when to use each method.
*
* @param {String} errorName Error name to be logged.
* @param {Object} [data] Additional data to be logged.
* @returns {String}
*/
export function logError( errorName, data ) {
console.error( ...formatConsoleArguments( errorName, data ) );
}
function getLinkToDocumentationMessage( errorName ) {
return `\nRead more: ${ DOCUMENTATION_URL }#error-${ errorName }`;
}
function formatConsoleArguments( errorName, data ) {
const documentationMessage = getLinkToDocumentationMessage( errorName );
return data ? [ errorName, data, documentationMessage ] : [ errorName, documentationMessage ];
}

@@ -789,2 +789,6 @@ /**

*
* Using a custom callback allows processing the value before passing it to the target property:
*
* button.bind( 'isEnabled' ).to( command, 'value', value => value === 'heading1' );
*
* It is also possible to bind to the same property in an array of observables.

@@ -791,0 +795,0 @@ * To bind a `button` to multiple commands (also `Observables`) so that each and every one of them

@@ -14,3 +14,3 @@ /**

const version = '23.0.0';
const version = '23.1.0';

@@ -112,3 +112,3 @@ /* istanbul ignore next */

* The solution to this issue is to update all packages to their latest version. We recommend
* using tools like [`node-check-updates`](https://www.npmjs.com/package/npm-check-updates) which simplify this process.
* using tools like [`npm-check-updates`](https://www.npmjs.com/package/npm-check-updates) which simplify this process.
*

@@ -115,0 +115,0 @@ * # Conflicting version of dependencies

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc