@ckeditor/ckeditor5-paragraph
Advanced tools
Comparing version 11.0.0 to 11.0.1
Changelog | ||
========= | ||
## [11.0.1](https://github.com/ckeditor/ckeditor5-paragraph/compare/v11.0.0...v11.0.1) (2019-04-10) | ||
Internal changes only (updated dependencies, documentation, etc.). | ||
## [11.0.0](https://github.com/ckeditor/ckeditor5-paragraph/compare/v10.0.4...v11.0.0) (2019-02-28) | ||
@@ -5,0 +10,0 @@ |
{ | ||
"name": "@ckeditor/ckeditor5-paragraph", | ||
"version": "11.0.0", | ||
"version": "11.0.1", | ||
"description": "Paragraph feature for CKEditor 5.", | ||
@@ -13,16 +13,16 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^12.0.0", | ||
"@ckeditor/ckeditor5-ui": "^12.0.0", | ||
"@ckeditor/ckeditor5-utils": "^12.0.0" | ||
"@ckeditor/ckeditor5-core": "^12.1.0", | ||
"@ckeditor/ckeditor5-ui": "^12.1.0", | ||
"@ckeditor/ckeditor5-utils": "^12.1.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-basic-styles": "^11.0.0", | ||
"@ckeditor/ckeditor5-clipboard": "^11.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^12.0.0", | ||
"@ckeditor/ckeditor5-engine": "^13.0.0", | ||
"@ckeditor/ckeditor5-enter": "^11.0.0", | ||
"@ckeditor/ckeditor5-heading": "^11.0.0", | ||
"@ckeditor/ckeditor5-link": "^11.0.0", | ||
"@ckeditor/ckeditor5-typing": "^12.0.0", | ||
"@ckeditor/ckeditor5-undo": "^11.0.0", | ||
"@ckeditor/ckeditor5-basic-styles": "^11.1.0", | ||
"@ckeditor/ckeditor5-clipboard": "^11.0.1", | ||
"@ckeditor/ckeditor5-editor-classic": "^12.1.0", | ||
"@ckeditor/ckeditor5-engine": "^13.1.0", | ||
"@ckeditor/ckeditor5-enter": "^11.0.1", | ||
"@ckeditor/ckeditor5-heading": "^11.0.1", | ||
"@ckeditor/ckeditor5-link": "^11.0.1", | ||
"@ckeditor/ckeditor5-typing": "^12.0.1", | ||
"@ckeditor/ckeditor5-undo": "^11.0.1", | ||
"eslint": "^5.5.0", | ||
@@ -29,0 +29,0 @@ "eslint-config-ckeditor5": "^1.0.11", |
@@ -46,45 +46,29 @@ /** | ||
// Handles elements not converted by plugins and checks if would be converted if | ||
// we wraps them by a paragraph or changes them to a paragraph. | ||
data.upcastDispatcher.on( 'element', ( evt, data, conversionApi ) => { | ||
const writer = conversionApi.writer; | ||
// When element is already consumed by higher priority converters then do nothing. | ||
if ( !conversionApi.consumable.test( data.viewItem, { name: data.viewItem.name } ) ) { | ||
return; | ||
} | ||
// When element is paragraph-like lets try to change it into a paragraph. | ||
if ( Paragraph.paragraphLikeElements.has( data.viewItem.name ) ) { | ||
if ( data.viewItem.isEmpty ) { | ||
return; | ||
// Handles element which has not been converted by any plugin and checks if it would be converted if | ||
// we wrap it in a paragraph or change it to a paragraph. | ||
editor.conversion.for( 'upcast' ).elementToElement( { | ||
model: ( viewElement, modelWriter ) => { | ||
if ( !Paragraph.paragraphLikeElements.has( viewElement.name ) ) { | ||
return null; | ||
} | ||
const paragraph = writer.createElement( 'paragraph' ); | ||
// Find allowed parent for paragraph that we are going to insert. | ||
// If current parent does not allow to insert paragraph but one of the ancestors does | ||
// then split nodes to allowed parent. | ||
const splitResult = conversionApi.splitToAllowedParent( paragraph, data.modelCursor ); | ||
// When there is no split result it means that we can't insert paragraph in this position. | ||
if ( !splitResult ) { | ||
return; | ||
// Do not auto-paragraph empty elements. | ||
if ( viewElement.isEmpty ) { | ||
return null; | ||
} | ||
// Insert paragraph in allowed position. | ||
writer.insert( paragraph, splitResult.position ); | ||
return modelWriter.createElement( 'paragraph' ); | ||
}, | ||
converterPriority: 'low' | ||
} ); | ||
// Convert children to paragraph. | ||
const { modelRange } = conversionApi.convertChildren( data.viewItem, writer.createPositionAt( paragraph, 0 ) ); | ||
data.upcastDispatcher.on( 'element', ( evt, data, conversionApi ) => { | ||
// Do not try auto-paragraphing if the element was already converted. | ||
if ( !conversionApi.consumable.test( data.viewItem, { name: data.viewItem.name } ) ) { | ||
return; | ||
} | ||
// Output range starts before paragraph but ends inside it after last child. | ||
// This is because we want to keep siblings inside the same paragraph as long as it is possible. | ||
// When next node won't be allowed in a paragraph it will split this paragraph anyway. | ||
data.modelRange = writer.createRange( writer.createPositionBefore( paragraph ), modelRange.end ); | ||
data.modelCursor = data.modelRange.end; | ||
// When element is not paragraph-like lets try to wrap it by a paragraph. | ||
} else if ( isParagraphable( data.viewItem, data.modelCursor, conversionApi.schema ) ) { | ||
data = Object.assign( data, wrapInParagraph( data.viewItem, data.modelCursor, conversionApi ) ); | ||
// If the element is not paragraph-like try wrapping it in a paragraph. | ||
if ( isParagraphable( data.viewItem, data.modelCursor, conversionApi.schema ) ) { | ||
Object.assign( data, wrapInParagraph( data.viewItem, data.modelCursor, conversionApi ) ); | ||
} | ||
@@ -101,3 +85,3 @@ }, { priority: 'low' } ); | ||
if ( isParagraphable( data.viewItem, data.modelCursor, conversionApi.schema ) ) { | ||
data = Object.assign( data, wrapInParagraph( data.viewItem, data.modelCursor, conversionApi ) ); | ||
Object.assign( data, wrapInParagraph( data.viewItem, data.modelCursor, conversionApi ) ); | ||
} | ||
@@ -104,0 +88,0 @@ }, { priority: 'lowest' } ); |
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
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
19762
4
272