@ckeditor/ckeditor5-enter
Advanced tools
Comparing version 0.7.0 to 0.8.0
{ | ||
"name": "@ckeditor/ckeditor5-enter", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Enter feature for CKEditor 5.", | ||
"keywords": [], | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "*", | ||
"@ckeditor/ckeditor5-engine": "*", | ||
"@ckeditor/ckeditor5-utils": "*" | ||
"@ckeditor/ckeditor5-core": "^0.7.0", | ||
"@ckeditor/ckeditor5-engine": "^0.8.0", | ||
"@ckeditor/ckeditor5-utils": "^0.8.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-dev-lint": "^2.0.0", | ||
"@ckeditor/ckeditor5-basic-styles": "*", | ||
"@ckeditor/ckeditor5-editor-classic": "*", | ||
"@ckeditor/ckeditor5-heading": "*", | ||
"@ckeditor/ckeditor5-typing": "*", | ||
"@ckeditor/ckeditor5-undo": "*", | ||
"@ckeditor/ckeditor5-dev-lint": "^2.0.2", | ||
"@ckeditor/ckeditor5-basic-styles": "^0.7.1", | ||
"@ckeditor/ckeditor5-editor-classic": "^0.7.1", | ||
"@ckeditor/ckeditor5-heading": "^0.8.0", | ||
"@ckeditor/ckeditor5-typing": "^0.8.0", | ||
"@ckeditor/ckeditor5-undo": "^0.7.1", | ||
"gulp": "^3.9.0", | ||
@@ -19,0 +19,0 @@ "guppy-pre-commit": "^0.4.0" |
@@ -27,3 +27,3 @@ /** | ||
doc.enqueueChanges( () => { | ||
enterBlock( this.editor.data, batch, doc.selection ); | ||
enterBlock( this.editor.data, batch, doc.selection, doc.schema ); | ||
@@ -40,3 +40,4 @@ this.fire( 'afterExecute', { batch } ); | ||
// @param {module:engine/model/selection~Selection} selection Selection on which the action should be performed. | ||
function enterBlock( dataController, batch, selection ) { | ||
// @param {module:engine/model/schema~Schema} schema | ||
function enterBlock( dataController, batch, selection, schema ) { | ||
const isSelectionEmpty = selection.isCollapsed; | ||
@@ -47,2 +48,7 @@ const range = selection.getFirstRange(); | ||
// Do nothing if selection starts or ends inside `limit` elements. | ||
if ( schema.limits.has( startElement.name ) || schema.limits.has( endElement.name ) ) { | ||
return; | ||
} | ||
// Don't touch the root. | ||
@@ -49,0 +55,0 @@ if ( startElement.root == startElement ) { |
@@ -29,3 +29,13 @@ /** | ||
schema.registerItem( 'h', '$block' ); | ||
schema.registerItem( 'inlineLimit' ); | ||
schema.registerItem( 'blockLimit' ); | ||
schema.allow( { name: 'inlineLimit', inside: 'p' } ); | ||
schema.allow( { name: '$text', inside: 'inlineLimit' } ); | ||
schema.allow( { name: '$text', inside: '$root' } ); | ||
schema.allow( { name: 'blockLimit', inside: '$root' } ); | ||
schema.allow( { name: 'p', inside: 'blockLimit' } ); | ||
schema.limits.add( 'inlineLimit' ); | ||
schema.limits.add( 'blockLimit' ); | ||
} ); | ||
@@ -111,2 +121,26 @@ } ); | ||
test( | ||
'should not break inline limit elements - collapsed', | ||
'<p><inlineLimit>foo[]bar</inlineLimit></p>', | ||
'<p><inlineLimit>foo[]bar</inlineLimit></p>' | ||
); | ||
test( | ||
'should not break inline limit elements', | ||
'<p><inlineLimit>foo[bar]baz</inlineLimit></p>', | ||
'<p><inlineLimit>foo[bar]baz</inlineLimit></p>' | ||
); | ||
test( | ||
'should not break inline limit elements - selection partially inside', | ||
'<p><inlineLimit>ba[r</inlineLimit></p><p>f]oo</p>', | ||
'<p><inlineLimit>ba[r</inlineLimit></p><p>f]oo</p>' | ||
); | ||
test( | ||
'should break paragraph in blockLimit', | ||
'<blockLimit><p>foo[]bar</p></blockLimit>', | ||
'<blockLimit><p>foo</p><p>[]bar</p></blockLimit>' | ||
); | ||
it( 'leaves one empty element after two were fully selected (backward)', () => { | ||
@@ -113,0 +147,0 @@ setData( doc, '<p>[abc</p><p>def]</p>' ); |
Sorry, the diff of this file is not supported yet
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
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 3 instances in 1 package
23188
23
411
0
+ Added@ckeditor/ckeditor5-core@0.7.0(transitive)
+ Added@ckeditor/ckeditor5-engine@0.8.0(transitive)
+ Added@ckeditor/ckeditor5-utils@0.8.0(transitive)
- Removed@ckeditor/ckeditor5-core@43.1.0(transitive)
- Removed@ckeditor/ckeditor5-engine@43.1.0(transitive)
- Removed@ckeditor/ckeditor5-utils@43.1.0(transitive)
- Removed@ckeditor/ckeditor5-watchdog@43.1.0(transitive)
- Removedlodash-es@4.17.21(transitive)