Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ckeditor/ckeditor5-typing

Package Overview
Dependencies
Maintainers
1
Versions
708
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-typing - npm Package Compare versions

Comparing version 10.0.0 to 10.0.1

7

CHANGELOG.md
Changelog
=========
## [10.0.1](https://github.com/ckeditor/ckeditor5-typing/compare/v10.0.0...v10.0.1) (2018-06-21)
### Bug fixes
* Bogus `<br />` element inserted by a browser at the end of an element is now correctly handled. Closes [ckeditor/ckeditor5#1083](https://github.com/ckeditor/ckeditor5/issues/1083). ([22abdff](https://github.com/ckeditor/ckeditor5-typing/commit/22abdff))
## [10.0.0](https://github.com/ckeditor/ckeditor5-typing/compare/v1.0.0-beta.4...v10.0.0) (2018-04-25)

@@ -5,0 +12,0 @@

30

package.json
{
"name": "@ckeditor/ckeditor5-typing",
"version": "10.0.0",
"version": "10.0.1",
"description": "Typing feature for CKEditor 5.",

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

"dependencies": {
"@ckeditor/ckeditor5-core": "^10.0.0",
"@ckeditor/ckeditor5-engine": "^10.0.0",
"@ckeditor/ckeditor5-utils": "^10.0.0"
"@ckeditor/ckeditor5-core": "^10.1.0",
"@ckeditor/ckeditor5-engine": "^10.1.0",
"@ckeditor/ckeditor5-utils": "^10.1.0"
},
"devDependencies": {
"@ckeditor/ckeditor5-basic-styles": "^10.0.0",
"@ckeditor/ckeditor5-block-quote": "^10.0.0",
"@ckeditor/ckeditor5-editor-classic": "^10.0.0",
"@ckeditor/ckeditor5-enter": "^10.0.0",
"@ckeditor/ckeditor5-essentials": "^10.0.0",
"@ckeditor/ckeditor5-heading": "^10.0.0",
"@ckeditor/ckeditor5-image": "^10.0.0",
"@ckeditor/ckeditor5-link": "^10.0.0",
"@ckeditor/ckeditor5-list": "^10.0.0",
"@ckeditor/ckeditor5-paragraph": "^10.0.0",
"@ckeditor/ckeditor5-undo": "^10.0.0",
"@ckeditor/ckeditor5-basic-styles": "^10.0.1",
"@ckeditor/ckeditor5-block-quote": "^10.0.1",
"@ckeditor/ckeditor5-editor-classic": "^10.0.1",
"@ckeditor/ckeditor5-enter": "^10.1.0",
"@ckeditor/ckeditor5-essentials": "^10.1.0",
"@ckeditor/ckeditor5-heading": "^10.0.1",
"@ckeditor/ckeditor5-image": "^10.1.0",
"@ckeditor/ckeditor5-link": "^10.0.2",
"@ckeditor/ckeditor5-list": "^11.0.0",
"@ckeditor/ckeditor5-paragraph": "^10.0.1",
"@ckeditor/ckeditor5-undo": "^10.0.1",
"eslint": "^4.15.0",

@@ -30,0 +30,0 @@ "eslint-config-ckeditor5": "^1.0.7",

@@ -7,3 +7,3 @@ CKEditor 5 typing feature

[![Build Status](https://travis-ci.org/ckeditor/ckeditor5-typing.svg?branch=master)](https://travis-ci.org/ckeditor/ckeditor5-typing)
[![BrowserStack Status](https://www.browserstack.com/automate/badge.svg?badge_key=d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0)](https://www.browserstack.com/automate/public-build/d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0)
[![BrowserStack Status](https://automate.browserstack.com/automate/badge.svg?badge_key=d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0)](https://automate.browserstack.com/public-build/d3hvenZqQVZERFQ5d09FWXdyT0ozVXhLaVltRFRjTTUyZGpvQWNmWVhUUT0tLUZqNlJ1YWRUd0RvdEVOaEptM1B2Q0E9PQ==--c9d3dee40b9b4471ff3fb516d9ecf8d09292c7e0)
[![Coverage Status](https://coveralls.io/repos/github/ckeditor/ckeditor5-typing/badge.svg?branch=master)](https://coveralls.io/github/ckeditor/ckeditor5-typing?branch=master)

@@ -10,0 +10,0 @@ <br>

@@ -214,11 +214,22 @@ /**

// Skip situations when common ancestor has any elements (cause they are too hard).
if ( !hasOnlyTextNodes( modelFromDomChildren ) || !hasOnlyTextNodes( currentModelChildren ) ) {
// Remove the last `<softBreak>` from the end of `modelFromDomChildren` if there is no `<softBreak>` in current model.
// If the described scenario happened, it means that this is a bogus `<br />` added by a browser.
const lastDomChild = modelFromDomChildren[ modelFromDomChildren.length - 1 ];
const lastCurrentChild = currentModelChildren[ currentModelChildren.length - 1 ];
if ( lastDomChild && lastDomChild.is( 'softBreak' ) && lastCurrentChild && !lastCurrentChild.is( 'softBreak' ) ) {
modelFromDomChildren.pop();
}
// Skip situations when common ancestor has any container elements.
if ( !isSafeForTextMutation( modelFromDomChildren ) || !isSafeForTextMutation( currentModelChildren ) ) {
return;
}
// Replace &nbsp; inserted by the browser with normal space.
// See comment in `_handleTextMutation`.
const newText = modelFromDomChildren.map( item => item.data ).join( '' ).replace( /\u00A0/g, ' ' );
const oldText = currentModelChildren.map( item => item.data ).join( '' );
// Replace &nbsp; inserted by the browser with normal space. See comment in `_handleTextMutation`.
// Replace non-texts with any character. This is potentially dangerous but passes in manual tests. The thing is
// that we need to take care of proper indexes so we cannot simply remove non-text elements from the content.
// By inserting a character we keep all the real texts on their indexes.
const newText = modelFromDomChildren.map( item => item.is( 'text' ) ? item.data : '@' ).join( '' ).replace( /\u00A0/g, ' ' );
const oldText = currentModelChildren.map( item => item.is( 'text' ) ? item.data : '@' ).join( '' );

@@ -451,8 +462,8 @@ // Do nothing if mutations created same text.

// Returns true if provided array contains only {@link module:engine/model/text~Text model text nodes}.
// Returns true if provided array contains content that won't be problematic during diffing and text mutation handling.
//
// @param {Array.<module:engine/model/node~Node>} children
// @returns {Boolean}
function hasOnlyTextNodes( children ) {
return children.every( child => child.is( 'text' ) );
function isSafeForTextMutation( children ) {
return children.every( child => child.is( 'text' ) || child.is( 'softBreak' ) );
}

@@ -464,3 +475,3 @@

// @param diffResult
// @return {{insertions: number, deletions: number, firstChangeAt: *}}
// @returns {{insertions: number, deletions: number, firstChangeAt: *}}
function calculateChanges( diffResult ) {

@@ -467,0 +478,0 @@ // Index where the first change happens. Used to set the position from which nodes will be removed and where will be inserted.

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