Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-undo

Package Overview
Dependencies
Maintainers
1
Versions
617
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-undo - npm Package Compare versions

Comparing version 20.0.0 to 21.0.0

lang/translations/bg.po

25

package.json
{
"name": "@ckeditor/ckeditor5-undo",
"version": "20.0.0",
"version": "21.0.0",
"description": "Undo manager for CKEditor 5.",

@@ -13,15 +13,16 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor5-core": "^20.0.0",
"@ckeditor/ckeditor5-engine": "^20.0.0",
"@ckeditor/ckeditor5-ui": "^20.0.0"
"@ckeditor/ckeditor5-core": "^21.0.0",
"@ckeditor/ckeditor5-engine": "^21.0.0",
"@ckeditor/ckeditor5-ui": "^21.0.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^20.0.0",
"@ckeditor/ckeditor5-clipboard": "^20.0.0",
"@ckeditor/ckeditor5-editor-classic": "^20.0.0",
"@ckeditor/ckeditor5-enter": "^20.0.0",
"@ckeditor/ckeditor5-heading": "^20.0.0",
"@ckeditor/ckeditor5-paragraph": "^20.0.0",
"@ckeditor/ckeditor5-typing": "^20.0.0",
"@ckeditor/ckeditor5-utils": "^20.0.0"
"@ckeditor/ckeditor5-basic-styles": "^21.0.0",
"@ckeditor/ckeditor5-clipboard": "^21.0.0",
"@ckeditor/ckeditor5-editor-classic": "^21.0.0",
"@ckeditor/ckeditor5-enter": "^21.0.0",
"@ckeditor/ckeditor5-heading": "^21.0.0",
"@ckeditor/ckeditor5-paragraph": "^21.0.0",
"@ckeditor/ckeditor5-typing": "^21.0.0",
"@ckeditor/ckeditor5-utils": "^21.0.0",
"@ckeditor/ckeditor5-table": "^21.0.0"
},

@@ -28,0 +29,0 @@ "engines": {

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

this.refresh();
this.listenTo( editor.data, 'set', () => this.clearStack() );
}

@@ -97,5 +99,13 @@

// Transform all ranges from the restored selection.
for ( const range of ranges ) {
const transformed = transformSelectionRange( range, operations );
const transformedRangeGroups = ranges.map( range => range.getTransformedByOperations( operations ) );
const allRanges = transformedRangeGroups.flat();
for ( const rangeGroup of transformedRangeGroups ) {
// While transforming there could appear ranges that are contained by other ranges, we shall ignore them.
const transformed = rangeGroup.filter( range => !isRangeContainedByAnyOtherRange( range, allRanges ) );
// After the range got transformed, we have an array of ranges. Some of those
// ranges may be "touching" -- they can be next to each other and could be merged.
normalizeRanges( transformed );
// For each `range` from `ranges`, we take only one transformed range.

@@ -106,3 +116,3 @@ // This is because we want to prevent situation where single-range selection

const newRange = transformed.find(
range => range.start.root != document.graveyard
range => range.root != document.graveyard
);

@@ -116,2 +126,4 @@

// @if CK_DEBUG_ENGINE // console.log( `Restored selection by undo: ${ selectionRanges.join( ', ' ) }` );
// `selectionRanges` may be empty if all ranges ended up in graveyard. If that is the case, do not restore selection.

@@ -174,26 +186,23 @@ if ( selectionRanges.length ) {

// Transforms given range `range` by given `operations`.
// Returns an array containing one or more ranges, which are result of the transformation.
function transformSelectionRange( range, operations ) {
const transformed = range.getTransformedByOperations( operations );
// Normalizes list of ranges by joining intersecting or "touching" ranges.
//
// @param {Array.<module:engine/model/range~Range>} ranges
//
function normalizeRanges( ranges ) {
ranges.sort( ( a, b ) => a.start.isBefore( b.start ) ? -1 : 1 );
// After `range` got transformed, we have an array of ranges. Some of those
// ranges may be "touching" -- they can be next to each other and could be merged.
// First, we have to sort those ranges to assure that they are in order.
transformed.sort( ( a, b ) => a.start.isBefore( b.start ) ? -1 : 1 );
for ( let i = 1; i < ranges.length; i++ ) {
const previousRange = ranges[ i - 1 ];
const joinedRange = previousRange.getJoined( ranges[ i ], true );
// Then, we check if two consecutive ranges are touching.
for ( let i = 1; i < transformed.length; i++ ) {
const a = transformed[ i - 1 ];
const b = transformed[ i ];
if ( a.end.isTouching( b.start ) ) {
// And join them together if they are.
a.end = b.end;
transformed.splice( i, 1 );
if ( joinedRange ) {
// Replace the ranges on the list with the new joined range.
i--;
ranges.splice( i, 2, joinedRange );
}
}
}
return transformed;
function isRangeContainedByAnyOtherRange( range, ranges ) {
return ranges.some( otherRange => otherRange !== range && otherRange.containsRange( range, true ) );
}

Sorry, the diff of this file is not supported yet

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