Sfoglia il codice sorgente

Moved getFillerOffset method to constructor in ViewListItemElement.

Szymon Kupś 9 anni fa
parent
commit
9009f0b7e3
1 ha cambiato i file con 13 aggiunte e 7 eliminazioni
  1. 13 7
      packages/ckeditor5-list/src/viewlistitemelement.js

+ 13 - 7
packages/ckeditor5-list/src/viewlistitemelement.js

@@ -21,14 +21,20 @@ export default class ViewListItemElement extends ViewContainerElement {
 	 */
 	constructor( attrs, children ) {
 		super( 'li', attrs, children );
+
+		/**
+		 * @inheritDoc
+		 */
+		this.getFillerOffset = getFillerOffset;
 	}
+}
 
-	/**
-	 * @inheritDoc
-	 */
-	getFillerOffset() {
-		const hasOnlyLists = !this.isEmpty && ( this.getChild( 0 ).name == 'ul' || this.getChild( 0 ).name == 'ol' );
+// Implementation of getFillerOffset for ViewListItemElements.
+//
+// @returns {Number|null} Block filler offset or `null` if block filler is not needed.
+function getFillerOffset() {
+	/*jshint validthis:true */
+	const hasOnlyLists = !this.isEmpty && ( this.getChild( 0 ).name == 'ul' || this.getChild( 0 ).name == 'ol' );
 
-		return this.isEmpty || hasOnlyLists ? 0 : null;
-	}
+	return this.isEmpty || hasOnlyLists ? 0 : null;
 }