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 19.0.2 to 20.0.0

16

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

@@ -12,14 +12,14 @@ "keywords": [

"dependencies": {
"lodash-es": "^4.17.10"
"lodash-es": "^4.17.15"
},
"devDependencies": {
"@ckeditor/ckeditor5-build-classic": "^19.0.2",
"@ckeditor/ckeditor5-editor-classic": "^19.0.1",
"@ckeditor/ckeditor5-core": "^19.0.1",
"@ckeditor/ckeditor5-engine": "^19.0.1",
"@ckeditor/ckeditor5-build-classic": "^20.0.0",
"@ckeditor/ckeditor5-editor-classic": "^20.0.0",
"@ckeditor/ckeditor5-core": "^20.0.0",
"@ckeditor/ckeditor5-engine": "^20.0.0",
"assertion-error": "^1.1.0",
"js-beautify": "^1.10.2"
"js-beautify": "^1.11.0"
},
"engines": {
"node": ">=8.0.0",
"node": ">=12.0.0",
"npm": ">=5.7.1"

@@ -26,0 +26,0 @@ },

@@ -132,2 +132,63 @@ /**

/**
* Returns `true` if the provided key code represents one of the arrow keys.
*
* @param {Number} keyCode A key code as in {@link module:utils/keyboard~KeystrokeInfo#keyCode}.
* @returns {Boolean}
*/
export function isArrowKeyCode( keyCode ) {
return keyCode == keyCodes.arrowright ||
keyCode == keyCodes.arrowleft ||
keyCode == keyCodes.arrowup ||
keyCode == keyCodes.arrowdown;
}
/**
* Returns the direction in which the {@link module:engine/model/documentselection~DocumentSelection selection}
* will move when a provided arrow key code is pressed considering the language direction of the editor content.
*
* For instance, in right–to–left (RTL) content languages, pressing the left arrow means moving selection right (forward)
* in the model structure. Similarly, pressing the right arrow moves the selection left (backward).
*
* @param {Number} keyCode A key code as in {@link module:utils/keyboard~KeystrokeInfo#keyCode}.
* @param {'ltr'|'rtl'} contentLanguageDirection The content language direction, corresponding to
* {@link module:utils/locale~Locale#contentLanguageDirection}.
* @returns {'left'|'up'|'right'|'down'} Localized arrow direction.
*/
export function getLocalizedArrowKeyCodeDirection( keyCode, contentLanguageDirection ) {
const isLtrContent = contentLanguageDirection === 'ltr';
switch ( keyCode ) {
case keyCodes.arrowleft:
return isLtrContent ? 'left' : 'right';
case keyCodes.arrowright:
return isLtrContent ? 'right' : 'left';
case keyCodes.arrowup:
return 'up';
case keyCodes.arrowdown:
return 'down';
}
}
/**
* Determines if the provided key code moves the {@link module:engine/model/documentselection~DocumentSelection selection}
* forward or backward considering the language direction of the editor content.
*
* For instance, in right–to–left (RTL) languages, pressing the left arrow means moving forward
* in the model structure. Similarly, pressing the right arrow moves the selection backward.
*
* @param {Number} keyCode A key code as in {@link module:utils/keyboard~KeystrokeInfo#keyCode}.
* @param {'ltr'|'rtl'} contentLanguageDirection The content language direction, corresponding to
* {@link module:utils/locale~Locale#contentLanguageDirection}.
* @returns {Boolean}
*/
export function isForwardArrowKeyCode( keyCode, contentLanguageDirection ) {
const localizedKeyCodeDirection = getLocalizedArrowKeyCodeDirection( keyCode, contentLanguageDirection );
return localizedKeyCodeDirection === 'down' || localizedKeyCodeDirection === 'right';
}
function generateKnownKeyCodes() {

@@ -134,0 +195,0 @@ const keyCodes = {

@@ -636,3 +636,3 @@ /**

if ( observable.hasOwnProperty( propertyName ) ) {
if ( Object.prototype.hasOwnProperty.call( observable, propertyName ) ) {
observable[ propertyName ] = propertyValue;

@@ -639,0 +639,0 @@ } else {

@@ -19,2 +19,3 @@ /**

export function isCombiningMark( character ) {
// eslint-disable-next-line no-misleading-character-class
return !!character && character.length == 1 && /[\u0300-\u036f\u1ab0-\u1aff\u1dc0-\u1dff\u20d0-\u20ff\ufe20-\ufe2f]/.test( character );

@@ -21,0 +22,0 @@ }

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

const version = '19.1.1';
const version = '20.0.0';

@@ -17,0 +17,0 @@ /* istanbul ignore next */

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