Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-engine

Package Overview
Dependencies
Maintainers
1
Versions
618
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-engine - npm Package Compare versions

Comparing version 27.1.0 to 28.0.0

40

package.json
{
"name": "@ckeditor/ckeditor5-engine",
"version": "27.1.0",
"version": "28.0.0",
"description": "The editing engine of CKEditor 5 – the best browser-based rich text editor.",

@@ -26,24 +26,24 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor5-utils": "^27.1.0",
"@ckeditor/ckeditor5-utils": "^28.0.0",
"lodash-es": "^4.17.15"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^27.1.0",
"@ckeditor/ckeditor5-block-quote": "^27.1.0",
"@ckeditor/ckeditor5-clipboard": "^27.1.0",
"@ckeditor/ckeditor5-core": "^27.1.0",
"@ckeditor/ckeditor5-editor-classic": "^27.1.0",
"@ckeditor/ckeditor5-enter": "^27.1.0",
"@ckeditor/ckeditor5-essentials": "^27.1.0",
"@ckeditor/ckeditor5-heading": "^27.1.0",
"@ckeditor/ckeditor5-image": "^27.1.0",
"@ckeditor/ckeditor5-link": "^27.1.0",
"@ckeditor/ckeditor5-list": "^27.1.0",
"@ckeditor/ckeditor5-paragraph": "^27.1.0",
"@ckeditor/ckeditor5-table": "^27.1.0",
"@ckeditor/ckeditor5-theme-lark": "^27.1.0",
"@ckeditor/ckeditor5-typing": "^27.1.0",
"@ckeditor/ckeditor5-ui": "^27.1.0",
"@ckeditor/ckeditor5-undo": "^27.1.0",
"@ckeditor/ckeditor5-widget": "^27.1.0",
"@ckeditor/ckeditor5-basic-styles": "^28.0.0",
"@ckeditor/ckeditor5-block-quote": "^28.0.0",
"@ckeditor/ckeditor5-clipboard": "^28.0.0",
"@ckeditor/ckeditor5-core": "^28.0.0",
"@ckeditor/ckeditor5-editor-classic": "^28.0.0",
"@ckeditor/ckeditor5-enter": "^28.0.0",
"@ckeditor/ckeditor5-essentials": "^28.0.0",
"@ckeditor/ckeditor5-heading": "^28.0.0",
"@ckeditor/ckeditor5-image": "^28.0.0",
"@ckeditor/ckeditor5-link": "^28.0.0",
"@ckeditor/ckeditor5-list": "^28.0.0",
"@ckeditor/ckeditor5-paragraph": "^28.0.0",
"@ckeditor/ckeditor5-table": "^28.0.0",
"@ckeditor/ckeditor5-theme-lark": "^28.0.0",
"@ckeditor/ckeditor5-typing": "^28.0.0",
"@ckeditor/ckeditor5-ui": "^28.0.0",
"@ckeditor/ckeditor5-undo": "^28.0.0",
"@ckeditor/ckeditor5-widget": "^28.0.0",
"webpack": "^4.43.0",

@@ -50,0 +50,0 @@ "webpack-cli": "^3.3.11"

@@ -656,3 +656,3 @@ /**

// then attribute conversion will be performed before a lot of element upcast converters.
// On the other hand we want to support `config.converterPriority` and overwriting conveters.
// On the other hand we want to support `config.converterPriority` and overwriting converters.
//

@@ -686,2 +686,13 @@ // To have it work, we need to do some extra processing for priority for attribute converter.

// Check if any attribute for the given view item can be consumed before changing the conversion data
// and consuming view items with these attributes.
if (
!conversionApi.consumable.test( data.viewItem, { attributes: attrName + '-end-after' } ) &&
!conversionApi.consumable.test( data.viewItem, { attributes: attrName + '-start-after' } ) &&
!conversionApi.consumable.test( data.viewItem, { attributes: attrName + '-end-before' } ) &&
!conversionApi.consumable.test( data.viewItem, { attributes: attrName + '-start-before' } )
) {
return;
}
// This converter wants to add a model element, marking a marker, before/after an element (or maybe even group of elements).

@@ -692,3 +703,3 @@ // To do that, we can use `data.modelRange` which is set on an element (or a group of elements) that has been upcasted.

if ( !data.modelRange ) {
data = Object.assign( data, conversionApi.convertChildren( data.viewItem, data.modelCursor ) );
Object.assign( data, conversionApi.convertChildren( data.viewItem, data.modelCursor ) );
}

@@ -874,11 +885,2 @@

const modelKey = config.model.key;
const modelValue = typeof config.model.value == 'function' ?
config.model.value( data.viewItem, conversionApi ) : config.model.value;
// Do not convert if attribute building function returned falsy value.
if ( modelValue === null ) {
return;
}
if ( onlyViewNameIsDefined( config.view, data.viewItem ) ) {

@@ -896,2 +898,11 @@ match.match.name = true;

const modelKey = config.model.key;
const modelValue = typeof config.model.value == 'function' ?
config.model.value( data.viewItem, conversionApi ) : config.model.value;
// Do not convert if attribute building function returned falsy value.
if ( modelValue === null ) {
return;
}
// Since we are converting to attribute we need a range on which we will set the attribute.

@@ -901,3 +912,3 @@ // If the range is not created yet, let's create it by converting children of the current node first.

// Convert children and set conversion result as a current data.
data = Object.assign( data, conversionApi.convertChildren( data.viewItem, data.modelCursor ) );
Object.assign( data, conversionApi.convertChildren( data.viewItem, data.modelCursor ) );
}

@@ -904,0 +915,0 @@

@@ -97,11 +97,11 @@ /**

/**
* If the processor is set to use marked fillers, it will insert nbsp fillers wrapped in spans
* (`<span data-cke-filler="true">&nbsp;</span>`), instead of regular nbsp characters (`&nbsp;`).
* If the processor is set to use marked fillers, it will insert `&nbsp;` fillers wrapped in `<span>` elements
* (`<span data-cke-filler="true">&nbsp;</span>`) instead of regular `&nbsp;` characters.
*
* This mode allows for more precise handling of block fillers (so they don't leak into editor content) but bloats the editor
* data with additional markup.
* This mode allows for more precise handling of block fillers (so they do not leak into the editor content) but bloats the
* editor data with additional markup.
*
* This mode may be required by some features and will be turned on by them automatically.
*
* @param {'default'|'marked'} type Whether to use default or marked nbsp block fillers.
* @param {'default'|'marked'} type Whether to use the default or marked `&nbsp;` block fillers.
*/

@@ -108,0 +108,0 @@ useFillerType( type ) {

@@ -114,11 +114,11 @@ /**

/**
* If the processor is set to use marked fillers, it will insert nbsp fillers wrapped in spans
* (`<span data-cke-filler="true">&nbsp;</span>`), instead of regular nbsp characters (`&nbsp;`).
* If the processor is set to use marked fillers, it will insert `&nbsp;` fillers wrapped in `<span>` elements
* (`<span data-cke-filler="true">&nbsp;</span>`) instead of regular `&nbsp;` characters.
*
* This mode allows for more precise handling of block fillers (so they don't leak into editor content) but bloats the editor
* data with additional markup.
* This mode allows for more precise handling of block fillers (so they do not leak into editor content) but bloats the
* editor data with additional markup.
*
* This mode may be required by some features and will be turned on by them automatically.
*
* @param {'default'|'marked'} type Whether to use default or marked nbsp block fillers.
* @param {'default'|'marked'} type Whether to use the default or marked `&nbsp;` block fillers.
*/

@@ -125,0 +125,0 @@ useFillerType( type ) {

@@ -99,3 +99,3 @@ /**

* @param {module:engine/model/position~PositionStickiness} [stickiness]
* @returns {module:engine/model/position~Position}
* @returns {module:engine/model/liveposition~LivePosition}
*/

@@ -102,0 +102,0 @@ static fromPosition( position, stickiness ) {

@@ -112,11 +112,11 @@ /**

allowContentOf: '$root',
allowChildren: '$text',
isLimit: true
} );
this.schema.extend( '$text', { allowIn: '$clipboardHolder' } );
this.schema.register( '$documentFragment', {
allowContentOf: '$root',
allowChildren: '$text',
isLimit: true
} );
this.schema.extend( '$text', { allowIn: '$documentFragment' } );

@@ -123,0 +123,0 @@ // An element needed by the `upcastElementToMarker` converter.

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

* @param {Boolean} [options.ignoreElementEnd=false]
* @returns {module:engine/model/treewalker~TreeWalker}
*/

@@ -1035,3 +1036,3 @@ getWalker( options = {} ) {

* @param {module:engine/model/document~Document} doc Document object that will be range owner.
* @returns {module:engine/model/element~Element} `Range` instance created using given plain object.
* @returns {module:engine/model/range~Range} `Range` instance created using given plain object.
*/

@@ -1038,0 +1039,0 @@ static fromJSON( json, doc ) {

@@ -385,6 +385,5 @@ /**

* Possible values: `'elementStart'` if walker is at the beginning of a node, `'elementEnd'` if walker is at the end of node,
* `'character'` if walker traversed over a character, or `'text'` if walker traversed over multiple characters (available in
* character merging mode, see {@link module:engine/model/treewalker~TreeWalker#constructor}).
* or `'text'` if walker traversed over text.
*
* @typedef {'elementStart'|'elementEnd'|'character'|'text'} module:engine/model/treewalker~TreeWalkerValueType
* @typedef {'elementStart'|'elementEnd'|'text'} module:engine/model/treewalker~TreeWalkerValueType
*/

@@ -408,3 +407,3 @@

* before the item.
* @property {Number} [length] Length of the item. For `'elementStart'` and `'character'` it is 1. For `'text'` it is
* @property {Number} [length] Length of the item. For `'elementStart'` it is 1. For `'text'` it is
* the length of the text. For `'elementEnd'` it is `undefined`.

@@ -411,0 +410,0 @@ */

@@ -151,3 +151,16 @@ /**

endPosition = selection.getLastPosition();
const newEndPosition = selection.getLastPosition();
// For such model and selection:
// <paragraph>A[</paragraph><image></image><paragraph>]B</paragraph>
//
// After modifySelection() we would end up with this:
// <paragraph>A[</paragraph>]<image></image><paragraph>B</paragraph>
//
// So we need to check if there is no content in the skipped range (because we want to include the <image>).
const skippedRange = model.createRange( newEndPosition, endPosition );
if ( !model.hasContent( skippedRange, { ignoreMarkers: true } ) ) {
endPosition = newEndPosition;
}
}

@@ -154,0 +167,0 @@ }

@@ -101,3 +101,3 @@ /**

* @see #_setTo
* @returns {Boolean}
* @type {Boolean}
*/

@@ -112,3 +112,3 @@ get isFake() {

* @see #_setTo
* @returns {String}
* @type {String}
*/

@@ -115,0 +115,0 @@ get fakeSelectionLabel() {

@@ -953,3 +953,3 @@ /**

/**
* Returns block {@link module:engine/view/filler filler} node based on current {@link #blockFillerMode} setting.
* Returns the block {@link module:engine/view/filler filler} node based on the current {@link #blockFillerMode} setting.
*

@@ -1351,11 +1351,12 @@ * @private

/**
* Enum representing type of the block filler.
* Enum representing the type of the block filler.
*
* Possible values:
*
* * `br` - for `<br data-cke-filler="true">` block filler used in the editing view,
* * `nbsp` - for `&nbsp;` block fillers used in the data,
* * `markedNbsp` - for nbsp block fillers wrapped in a span: `<span data-cke-filler="true">&nbsp;</span>` used in the data.
* * `br` &ndash; For the `<br data-cke-filler="true">` block filler used in the editing view.
* * `nbsp` &ndash; For the `&nbsp;` block fillers used in the data.
* * `markedNbsp` &ndash; For the `&nbsp;` block fillers wrapped in a `<span>` element: `<span data-cke-filler="true">&nbsp;</span>`
* used in the data.
*
* @typedef {String} module:engine/view/filler~BlockFillerMode
*/

@@ -10,3 +10,3 @@ /**

/**
* Set of utils related to block and inline fillers handling.
* Set of utilities related to handling block and inline fillers.
*

@@ -40,3 +40,3 @@ * Browsers do not allow to put caret in elements which does not have height. Because of it, we need to fill all

/**
* Non-breaking space filler creator. This is a function which creates `&nbsp;` text node.
* Non-breaking space filler creator. This function creates the `&nbsp;` text node.
* It defines how the filler is created.

@@ -51,3 +51,3 @@ *

/**
* Marked non-breaking space filler creator. This is a function which creates `<span data-cke-filler="true">&nbsp;</span>` element.
* Marked non-breaking space filler creator. This function creates the `<span data-cke-filler="true">&nbsp;</span>` element.
* It defines how the filler is created.

@@ -68,3 +68,3 @@ *

/**
* `<br>` filler creator. This is a function which creates `<br data-cke-filler="true">` element.
* `<br>` filler creator. This function creates the `<br data-cke-filler="true">` element.
* It defines how the filler is created.

@@ -71,0 +71,0 @@ *

@@ -24,3 +24,3 @@ /**

this.domEventType = [ 'mousedown', 'mouseup' ];
this.domEventType = [ 'mousedown', 'mouseup', 'mouseover', 'mouseout' ];
}

@@ -27,0 +27,0 @@

@@ -262,3 +262,11 @@ /**

const actualDomChildren = this.domConverter.mapViewToDom( viewElement ).childNodes;
// Removing nodes from the DOM as we iterate can cause `actualDomChildren`
// (which is a live-updating `NodeList`) to get out of sync with the
// indices that we compute as we iterate over `actions`, producing
// incorrect element mappings.
//
// Converting live list to an array to make the list static.
const actualDomChildren = Array.from(
this.domConverter.mapViewToDom( viewElement ).childNodes
);
const expectedDomChildren = Array.from(

@@ -265,0 +273,0 @@ this.domConverter.viewChildrenToDom( viewElement, domElement.ownerDocument, { withChildren: false } )

@@ -137,3 +137,3 @@ /**

* @see #setTo
* @returns {Boolean}
* @type {Boolean}
*/

@@ -148,3 +148,3 @@ get isFake() {

* @see #setTo
* @returns {String}
* @type {String}
*/

@@ -151,0 +151,0 @@ get fakeSelectionLabel() {

@@ -42,5 +42,2 @@ /**

*
* The `border` value is reduced to a 4 values for each box edge (even if they could be further reduces to a single
* `border:<width> <style> <color>` style.
*
* @param {module:engine/view/stylesmap~StylesProcessor} stylesProcessor

@@ -106,3 +103,3 @@ */

stylesProcessor.setReducer( 'border-left', getBorderPositionReducer( 'left' ) );
stylesProcessor.setReducer( 'border', borderReducer );
stylesProcessor.setReducer( 'border', getBorderReducer() );

@@ -243,11 +240,79 @@ stylesProcessor.setStyleRelation( 'border', [

function borderReducer( value ) {
const reduced = [];
// The border reducer factory.
//
// It tries to produce the most optimal output for the specified styles.
//
// For border style:
//
// style: {top: "solid", bottom: "solid", right: "solid", left: "solid"}
//
// It will produce: `border-style: solid` output.
// For border style and color:
//
// color: {top: "#ff0", bottom: "#ff0", right: "#ff0", left: "#ff0"}
// style: {top: "solid", bottom: "solid", right: "solid", left: "solid"}
//
// It will produce: `border-color: #ff0; border-style: solid`
// If all border parameters are specified:
//
// color: {top: "#ff0", bottom: "#ff0", right: "#ff0", left: "#ff0"}
// style: {top: "solid", bottom: "solid", right: "solid", left: "solid"}
// width: {top: "2px", bottom: "2px", right: "2px", left: "2px"}
//
// It will combine everything into the single property: `border: 2px solid #ff0`.
//
// Definitions are merged only if all border selectors have the same values.
//
// @returns {Function}
function getBorderReducer() {
return value => {
const topStyles = extractBorderPosition( value, 'top' );
const rightStyles = extractBorderPosition( value, 'right' );
const bottomStyles = extractBorderPosition( value, 'bottom' );
const leftStyles = extractBorderPosition( value, 'left' );
reduced.push( ...reduceBorderPosition( extractBorderPosition( value, 'top' ), 'top' ) );
reduced.push( ...reduceBorderPosition( extractBorderPosition( value, 'right' ), 'right' ) );
reduced.push( ...reduceBorderPosition( extractBorderPosition( value, 'bottom' ), 'bottom' ) );
reduced.push( ...reduceBorderPosition( extractBorderPosition( value, 'left' ), 'left' ) );
const borderStyles = [ topStyles, rightStyles, bottomStyles, leftStyles ];
return reduced;
const borderStylesByType = {
width: getReducedStyleValueForType( borderStyles, 'width' ),
style: getReducedStyleValueForType( borderStyles, 'style' ),
color: getReducedStyleValueForType( borderStyles, 'color' )
};
// Try reducing to a single `border:` property.
const reducedBorderStyle = reduceBorderPosition( borderStylesByType, 'all' );
if ( reducedBorderStyle.length ) {
return reducedBorderStyle;
}
// Try reducing to `border-style:`, `border-width:`, `border-color:` properties.
const reducedStyleTypes = Object.entries( borderStylesByType ).reduce( ( reducedStyleTypes, [ type, value ] ) => {
if ( value ) {
reducedStyleTypes.push( [ `border-${ type }`, value ] );
// Remove it from the full set to not include it in the most specific properties later.
borderStyles.forEach( style => ( style[ type ] = null ) );
}
return reducedStyleTypes;
}, [] );
// The reduced properties (by type) and all the rest that could not be reduced.
return [
...reducedStyleTypes,
...reduceBorderPosition( topStyles, 'top' ),
...reduceBorderPosition( rightStyles, 'right' ),
...reduceBorderPosition( bottomStyles, 'bottom' ),
...reduceBorderPosition( leftStyles, 'left' )
];
};
// @param {Array.<Object>} styles The array of objects with `style`, `color`, `width` properties.
// @param {'width'|'style'|'color'} type
function getReducedStyleValueForType( styles, type ) {
return styles
.map( style => style[ type ] )
.reduce( ( result, style ) => result == style ? result : null );
}
}

@@ -259,22 +324,43 @@

// Returns an array with reduced border styles depending on specified values.
//
// If all (width, style, color) border properties are specified, the returned selector will be
// merged into the group: `border-*: [width] [style] [color]`.
//
// Otherwise, the specific definitions will be returned: `border-(width|style|color)-*: [value]`.
//
// @param {Object|null} value Styles if defined.
// @param {'top'|'right'|'bottom'|'left'|'all'} which The border position.
// @returns {Array}
function reduceBorderPosition( value, which ) {
const reduced = [];
const borderTypes = [];
if ( value && value.width !== undefined ) {
reduced.push( value.width );
if ( value && value.width ) {
borderTypes.push( 'width' );
}
if ( value && value.style !== undefined ) {
reduced.push( value.style );
if ( value && value.style ) {
borderTypes.push( 'style' );
}
if ( value && value.color !== undefined ) {
reduced.push( value.color );
if ( value && value.color ) {
borderTypes.push( 'color' );
}
if ( reduced.length ) {
return [ [ `border-${ which }`, reduced.join( ' ' ) ] ];
if ( borderTypes.length == 3 ) {
const borderValue = borderTypes.map( item => value[ item ] ).join( ' ' );
return [
which == 'all' ? [ 'border', borderValue ] : [ `border-${ which }`, borderValue ]
];
}
return [];
// We are unable to reduce to a single `border:` property.
if ( which == 'all' ) {
return [];
}
return borderTypes.map( type => {
return [ `border-${ which }-${ type }`, value[ type ] ];
} );
}

@@ -223,3 +223,3 @@ /**

* @param {module:engine/view/stylesmap~BoxSides} styleShorthand
* @returns {Function}
* @returns {String}
*/

@@ -226,0 +226,0 @@ export function getBoxSidesShorthandValue( { top, right, bottom, left } ) {

@@ -47,3 +47,3 @@ /**

*
* @returns {Boolean}
* @type {Boolean}
*/

@@ -544,3 +544,2 @@ get isEmpty() {

*
* @param {String} name
* @param {String} name Name of style property.

@@ -547,0 +546,0 @@ * @param {Object} styles Object holding normalized styles.

@@ -225,3 +225,3 @@ /**

*
* writer.setAttribute( linkElement, 'href', 'http://ckeditor.com' );
* writer.setAttribute( 'href', 'http://ckeditor.com', linkElement );
*

@@ -240,3 +240,3 @@ * @see module:engine/view/element~Element#_setAttribute

*
* writer.removeAttribute( linkElement, 'href' );
* writer.removeAttribute( 'href', linkElement );
*

@@ -254,4 +254,4 @@ * @see module:engine/view/element~Element#_removeAttribute

*
* writer.addClass( linkElement, 'foo' );
* writer.addClass( linkElement, [ 'foo', 'bar' ] );
* writer.addClass( 'foo', linkElement );
* writer.addClass( [ 'foo', 'bar' ], linkElement );
*

@@ -269,4 +269,4 @@ * @see module:engine/view/element~Element#_addClass

*
* writer.removeClass( linkElement, 'foo' );
* writer.removeClass( linkElement, [ 'foo', 'bar' ] );
* writer.removeClass( 'foo', linkElement );
* writer.removeClass( [ 'foo', 'bar' ], linkElement );
*

@@ -284,7 +284,7 @@ * @see module:engine/view/element~Element#_removeClass

*
* writer.setStyle( element, 'color', 'red' );
* writer.setStyle( element, {
* writer.setStyle( 'color', 'red', element );
* writer.setStyle( {
* color: 'red',
* position: 'fixed'
* } );
* }, element );
*

@@ -310,4 +310,4 @@ * **Note**: This method can work with normalized style names if

*
* writer.removeStyle( element, 'color' ); // Removes 'color' style.
* writer.removeStyle( element, [ 'color', 'border-top' ] ); // Removes both 'color' and 'border-top' styles.
* writer.removeStyle( 'color', element ); // Removes 'color' style.
* writer.removeStyle( [ 'color', 'border-top' ], element ); // Removes both 'color' and 'border-top' styles.
*

@@ -367,2 +367,3 @@ * **Note**: This method can work with normalized style names if

* first parameter is a {@link module:engine/view/item~Item view item}.
* @returns {module:engine/view/position~Position}
*/

@@ -369,0 +370,0 @@ createPositionAt( itemOrPosition, offset ) {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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