Skip to content

Commit 3003aee

Browse files
committed
MC-3991: Firefox - Removing Column Issues
- Fix spreadWidth function arguments
1 parent 7e43bb1 commit 3003aee

File tree

2 files changed

+18
-20
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+18
-20
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/column-group/preview.js

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/column-group/preview.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default class Preview extends PreviewCollection {
107107

108108
events.on("contentType:removeAfter", (args: ContentTypeRemovedEventParamsInterface) => {
109109
if (args.parent.id === this.parent.id) {
110-
this.spreadWidth(event, args);
110+
this.spreadWidth(args.index);
111111
}
112112
});
113113

@@ -952,12 +952,11 @@ export default class Preview extends PreviewCollection {
952952
}
953953

954954
/**
955-
* Spread any empty space across the other columns
955+
* Spread any empty space across the other columns when a column is removed
956956
*
957-
* @param {Event} event
958-
* @param {ContentTypeRemovedEventParamsInterface} params
957+
* @param {number} removedIndex
959958
*/
960-
private spreadWidth(event: Event, params: ContentTypeRemovedEventParamsInterface): void {
959+
private spreadWidth(removedIndex: number): void {
961960
if (this.parent.children().length === 0) {
962961
return;
963962
}
@@ -995,15 +994,15 @@ export default class Preview extends PreviewCollection {
995994
let columnToModify: ContentTypeCollectionInterface<ColumnPreview>;
996995

997996
// 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>;
10011000
}
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"
10041003
) {
10051004
columnToModify =
1006-
this.parent.children()[params.index - i] as ContentTypeCollectionInterface<ColumnPreview>;
1005+
this.parent.children()[removedIndex - i] as ContentTypeCollectionInterface<ColumnPreview>;
10071006
}
10081007
if (columnToModify) {
10091008
updateColumnWidth(

0 commit comments

Comments
 (0)