@ckeditor/ckeditor5-page-break
Advanced tools
Comparing version 20.0.0 to 21.0.0
{ | ||
"name": "@ckeditor/ckeditor5-page-break", | ||
"version": "20.0.0", | ||
"version": "21.0.0", | ||
"description": "Page break feature for CKEditor 5.", | ||
@@ -13,14 +13,14 @@ "keywords": [ | ||
"dependencies": { | ||
"@ckeditor/ckeditor5-core": "^20.0.0", | ||
"@ckeditor/ckeditor5-ui": "^20.0.0", | ||
"@ckeditor/ckeditor5-widget": "^20.0.0" | ||
"@ckeditor/ckeditor5-core": "^21.0.0", | ||
"@ckeditor/ckeditor5-ui": "^21.0.0", | ||
"@ckeditor/ckeditor5-widget": "^21.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ckeditor/ckeditor5-cloud-services": "^20.0.0", | ||
"@ckeditor/ckeditor5-engine": "^20.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^20.0.0", | ||
"@ckeditor/ckeditor5-easy-image": "^20.0.0", | ||
"@ckeditor/ckeditor5-image": "^20.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^20.0.0", | ||
"@ckeditor/ckeditor5-utils": "^20.0.0" | ||
"@ckeditor/ckeditor5-cloud-services": "^21.0.0", | ||
"@ckeditor/ckeditor5-engine": "^21.0.0", | ||
"@ckeditor/ckeditor5-editor-classic": "^21.0.0", | ||
"@ckeditor/ckeditor5-easy-image": "^21.0.0", | ||
"@ckeditor/ckeditor5-image": "^21.0.0", | ||
"@ckeditor/ckeditor5-paragraph": "^21.0.0", | ||
"@ckeditor/ckeditor5-utils": "^21.0.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "engines": { |
@@ -110,3 +110,3 @@ /** | ||
if ( parent.isEmpty && !parent.is( '$root' ) ) { | ||
if ( parent.isEmpty && !parent.is( 'element', '$root' ) ) { | ||
return parent.parent; | ||
@@ -113,0 +113,0 @@ } |
@@ -13,3 +13,2 @@ /** | ||
import { toWidget } from '@ckeditor/ckeditor5-widget/src/utils'; | ||
import first from '@ckeditor/ckeditor5-utils/src/first'; | ||
@@ -89,17 +88,27 @@ import '../theme/pagebreak.css'; | ||
view: element => { | ||
// The "page break" div must have specified value for the 'page-break-after' definition and single child only. | ||
if ( !element.is( 'div' ) || element.getStyle( 'page-break-after' ) != 'always' || element.childCount != 1 ) { | ||
return; | ||
} | ||
// For upcast conversion it's enough if we check for element style and verify if it's empty | ||
// or contains only hidden span element. | ||
const viewSpan = first( element.getChildren() ); | ||
const hasPageBreakBefore = element.getStyle( 'page-break-before' ) == 'always'; | ||
const hasPageBreakAfter = element.getStyle( 'page-break-after' ) == 'always'; | ||
// The child must be the "span" element that is not displayed and has a space inside. | ||
if ( !viewSpan.is( 'span' ) || viewSpan.getStyle( 'display' ) != 'none' || viewSpan.childCount != 1 ) { | ||
if ( !hasPageBreakBefore && !hasPageBreakAfter ) { | ||
return; | ||
} | ||
const text = first( viewSpan.getChildren() ); | ||
// The "page break" div accepts only single child or no child at all. | ||
if ( element.childCount == 1 ) { | ||
const viewSpan = element.getChild( 0 ); | ||
if ( !text.is( 'text' ) || text.data !== ' ' ) { | ||
// The child must be the "span" element that is not displayed and has a space inside. | ||
if ( !viewSpan.is( 'element', 'span' ) || viewSpan.getStyle( 'display' ) != 'none' || viewSpan.childCount != 1 ) { | ||
return; | ||
} | ||
const text = viewSpan.getChild( 0 ); | ||
if ( !text.is( '$text' ) || text.data !== ' ' ) { | ||
return; | ||
} | ||
} else if ( element.childCount > 1 ) { | ||
return; | ||
@@ -110,3 +119,7 @@ } | ||
}, | ||
model: 'pageBreak' | ||
model: 'pageBreak', | ||
// This conversion must be checked before <br> conversion because some editors use | ||
// <br style="page-break-before:always"> as a page break marker. | ||
converterPriority: 'high' | ||
} ); | ||
@@ -113,0 +126,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
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
42903
42
329
+ Added@ckeditor/ckeditor5-core@21.0.0(transitive)
+ Added@ckeditor/ckeditor5-engine@21.0.0(transitive)
+ Added@ckeditor/ckeditor5-typing@21.0.0(transitive)
+ Added@ckeditor/ckeditor5-ui@21.0.0(transitive)
+ Added@ckeditor/ckeditor5-utils@21.0.0(transitive)
+ Added@ckeditor/ckeditor5-widget@21.0.0(transitive)
- Removed@ckeditor/ckeditor5-core@20.0.0(transitive)
- Removed@ckeditor/ckeditor5-engine@20.0.0(transitive)
- Removed@ckeditor/ckeditor5-typing@20.0.0(transitive)
- Removed@ckeditor/ckeditor5-ui@20.0.0(transitive)
- Removed@ckeditor/ckeditor5-utils@20.0.0(transitive)
- Removed@ckeditor/ckeditor5-widget@20.0.0(transitive)