|
|
@@ -7,6 +7,8 @@
|
|
|
* @module list/utils
|
|
|
*/
|
|
|
|
|
|
+import { getFillerOffset } from '@ckeditor/ckeditor5-engine/src/view/containerelement';
|
|
|
+
|
|
|
/**
|
|
|
* Creates list item {@link module:engine/view/containerelement~ContainerElement}.
|
|
|
*
|
|
|
@@ -15,7 +17,7 @@
|
|
|
*/
|
|
|
export function createViewListItemElement( writer ) {
|
|
|
const viewItem = writer.createContainerElement( 'li' );
|
|
|
- viewItem.getFillerOffset = getFillerOffset;
|
|
|
+ viewItem.getFillerOffset = _getFillerOffset;
|
|
|
|
|
|
return viewItem;
|
|
|
}
|
|
|
@@ -23,21 +25,12 @@ export function createViewListItemElement( writer ) {
|
|
|
// Implementation of getFillerOffset for view list item element.
|
|
|
//
|
|
|
// @returns {Number|null} Block filler offset or `null` if block filler is not needed.
|
|
|
-function getFillerOffset() {
|
|
|
+function _getFillerOffset() {
|
|
|
const hasOnlyLists = !this.isEmpty && ( this.getChild( 0 ).name == 'ul' || this.getChild( 0 ).name == 'ol' );
|
|
|
|
|
|
if ( this.isEmpty || hasOnlyLists ) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- const children = [ ...this.getChildren() ];
|
|
|
- const lastChild = children[ this.childCount - 1 ];
|
|
|
-
|
|
|
- // Block filler is required after a `<br>` if it's the last element in its container.
|
|
|
- // See: https://github.com/ckeditor/ckeditor5/issues/1312#issuecomment-436669045.
|
|
|
- if ( lastChild && lastChild.is( 'element', 'br' ) ) {
|
|
|
- return this.childCount;
|
|
|
- }
|
|
|
-
|
|
|
- return null;
|
|
|
+ return getFillerOffset.call( this );
|
|
|
}
|