@ckeditor/ckeditor5-typing
Advanced tools
Comparing version 24.0.0 to 25.0.0
@@ -5,3 +5,3 @@ Software License Agreement | ||
**CKEditor 5 Typing Feature** – https://github.com/ckeditor/ckeditor5-typing <br> | ||
Copyright (c) 2003-2020, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved. | ||
Copyright (c) 2003-2021, [CKSource](http://cksource.com) Frederico Knabben. All rights reserved. | ||
@@ -8,0 +8,0 @@ Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html). |
{ | ||
"name": "@ckeditor/ckeditor5-typing", | ||
"version": "24.0.0", | ||
"version": "25.0.0", | ||
"description": "Typing feature for CKEditor 5.", | ||
@@ -13,20 +13,20 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^24.0.0", | ||
"@ckeditor/ckeditor5-engine": "^24.0.0", | ||
"@ckeditor/ckeditor5-utils": "^24.0.0", | ||
"@ckeditor/ckeditor5-core": "^25.0.0", | ||
"@ckeditor/ckeditor5-engine": "^25.0.0", | ||
"@ckeditor/ckeditor5-utils": "^25.0.0", | ||
"lodash-es": "^4.17.15" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^24.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^24.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^24.0.0", | ||
"@ckeditor/ckeditor5-enter": "^24.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^24.0.0", | ||
"@ckeditor/ckeditor5-heading": "^24.0.0", | ||
"@ckeditor/ckeditor5-image": "^24.0.0", | ||
"@ckeditor/ckeditor5-link": "^24.0.0", | ||
"@ckeditor/ckeditor5-list": "^24.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^24.0.0", | ||
"@ckeditor/ckeditor5-undo": "^24.0.0", | ||
"@ckeditor/ckeditor5-code-block": "^24.0.0" | ||
"@ckeditor/ckeditor5-basic-styles": "^25.0.0", | ||
"@ckeditor/ckeditor5-block-quote": "^25.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^25.0.0", | ||
"@ckeditor/ckeditor5-enter": "^25.0.0", | ||
"@ckeditor/ckeditor5-essentials": "^25.0.0", | ||
"@ckeditor/ckeditor5-heading": "^25.0.0", | ||
"@ckeditor/ckeditor5-image": "^25.0.0", | ||
"@ckeditor/ckeditor5-link": "^25.0.0", | ||
"@ckeditor/ckeditor5-list": "^25.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^25.0.0", | ||
"@ckeditor/ckeditor5-undo": "^25.0.0", | ||
"@ckeditor/ckeditor5-code-block": "^25.0.0" | ||
}, | ||
@@ -33,0 +33,0 @@ "engines": { |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -80,2 +80,3 @@ */ | ||
const selection = writer.createSelection( options.selection || doc.selection ); | ||
const sequence = options.sequence || 1; | ||
@@ -95,3 +96,3 @@ // Do not replace the whole selected content if selection was collapsed. | ||
// Check if deleting in an empty editor. See #61. | ||
if ( this._shouldEntireContentBeReplacedWithParagraph( options.sequence || 1 ) ) { | ||
if ( this._shouldEntireContentBeReplacedWithParagraph( sequence ) ) { | ||
this._replaceEntireContentWithParagraph( writer ); | ||
@@ -102,2 +103,10 @@ | ||
// Check if deleting in the first empty block. | ||
// See https://github.com/ckeditor/ckeditor5/issues/8137. | ||
if ( this._shouldReplaceFirstBlockWithParagraph( selection, sequence ) ) { | ||
this.editor.execute( 'paragraph', { selection } ); | ||
return; | ||
} | ||
// If selection is still collapsed, then there's nothing to delete. | ||
@@ -186,2 +195,3 @@ if ( selection.isCollapsed ) { | ||
* @private | ||
* @param {module:engine/model/writer~Writer} writer The model writer. | ||
*/ | ||
@@ -200,2 +210,51 @@ _replaceEntireContentWithParagraph( writer ) { | ||
} | ||
/** | ||
* Checks if the selection is inside an empty element that is the first child of the limit element | ||
* and should be replaced with a paragraph. | ||
* | ||
* @private | ||
* @param {module:engine/model/selection~Selection} selection The selection. | ||
* @param {Number} sequence A number describing which subsequent delete event it is without the key being released. | ||
* @returns {Boolean} | ||
*/ | ||
_shouldReplaceFirstBlockWithParagraph( selection, sequence ) { | ||
const model = this.editor.model; | ||
// Does nothing if user pressed and held the "Backspace" key or it was a "Delete" button. | ||
if ( sequence > 1 || this.direction != 'backward' ) { | ||
return false; | ||
} | ||
if ( !selection.isCollapsed ) { | ||
return false; | ||
} | ||
const position = selection.getFirstPosition(); | ||
const limitElement = model.schema.getLimitElement( position ); | ||
const limitElementFirstChild = limitElement.getChild( 0 ); | ||
// Only elements that are direct children of the limit element can be replaced. | ||
// Unwrapping from a block quote should be handled in a dedicated feature. | ||
if ( position.parent != limitElementFirstChild ) { | ||
return false; | ||
} | ||
// A block should be replaced only if it was empty. | ||
if ( !selection.containsEntireContent( limitElementFirstChild ) ) { | ||
return false; | ||
} | ||
// Replace with a paragraph only if it's allowed there. | ||
if ( !model.schema.checkChild( limitElement, 'paragraph' ) ) { | ||
return false; | ||
} | ||
// Does nothing if the limit element already contains only a paragraph. | ||
if ( limitElementFirstChild.name == 'paragraph' ) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
} |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
/** | ||
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved. | ||
* @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved. | ||
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license | ||
@@ -4,0 +4,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Copyleft License
License(Experimental) Copyleft license information was found.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
112413
3
2418
+ Added@ckeditor/ckeditor5-core@25.0.0(transitive)
+ Added@ckeditor/ckeditor5-engine@25.0.0(transitive)
+ Added@ckeditor/ckeditor5-ui@25.0.0(transitive)
+ Added@ckeditor/ckeditor5-utils@25.0.0(transitive)
- Removed@ckeditor/ckeditor5-core@24.0.0(transitive)
- Removed@ckeditor/ckeditor5-engine@24.0.0(transitive)
- Removed@ckeditor/ckeditor5-utils@24.0.0(transitive)