@@ -107,7 +107,7 @@ export default class Preview extends PreviewCollection {
107
107
108
108
events . on ( "contentType:removeAfter" , ( args : ContentTypeRemovedEventParamsInterface ) => {
109
109
if ( args . parent . id === this . parent . id ) {
110
- this . spreadWidth ( event , args ) ;
110
+ this . spreadWidth ( args . index ) ;
111
111
}
112
112
} ) ;
113
113
@@ -952,12 +952,11 @@ export default class Preview extends PreviewCollection {
952
952
}
953
953
954
954
/**
955
- * Spread any empty space across the other columns
955
+ * Spread any empty space across the other columns when a column is removed
956
956
*
957
- * @param {Event } event
958
- * @param {ContentTypeRemovedEventParamsInterface } params
957
+ * @param {number } removedIndex
959
958
*/
960
- private spreadWidth ( event : Event , params : ContentTypeRemovedEventParamsInterface ) : void {
959
+ private spreadWidth ( removedIndex : number ) : void {
961
960
if ( this . parent . children ( ) . length === 0 ) {
962
961
return ;
963
962
}
@@ -995,15 +994,15 @@ export default class Preview extends PreviewCollection {
995
994
let columnToModify : ContentTypeCollectionInterface < ColumnPreview > ;
996
995
997
996
// As the original column has been removed from the array, check the new index for a column
998
- if ( ( params . index ) <= this . parent . children ( ) . length
999
- && typeof this . parent . children ( ) [ params . index ] !== "undefined" ) {
1000
- columnToModify = this . parent . children ( ) [ params . index ] as ContentTypeCollectionInterface < ColumnPreview > ;
997
+ if ( removedIndex <= this . parent . children ( ) . length
998
+ && typeof this . parent . children ( ) [ removedIndex ] !== "undefined" ) {
999
+ columnToModify = this . parent . children ( ) [ removedIndex ] as ContentTypeCollectionInterface < ColumnPreview > ;
1001
1000
}
1002
- if ( ! columnToModify && ( params . index - i ) >= 0 &&
1003
- typeof this . parent . children ( ) [ params . index - i ] !== "undefined"
1001
+ if ( ! columnToModify && ( removedIndex - i ) >= 0 &&
1002
+ typeof this . parent . children ( ) [ removedIndex - i ] !== "undefined"
1004
1003
) {
1005
1004
columnToModify =
1006
- this . parent . children ( ) [ params . index - i ] as ContentTypeCollectionInterface < ColumnPreview > ;
1005
+ this . parent . children ( ) [ removedIndex - i ] as ContentTypeCollectionInterface < ColumnPreview > ;
1007
1006
}
1008
1007
if ( columnToModify ) {
1009
1008
updateColumnWidth (
0 commit comments