Skip to content

Commit a1248d9

Browse files
author
Hwashiang Yu
committed
MC-3691: utton Sizes Are Not Always The Same When Button Has Long Text Without Spaces
- Updated resizeChildButtons logic to correctly calculate within a container
1 parent db6b664 commit a1248d9

File tree

2 files changed

+5
-6
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+5
-6
lines changed

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

Lines changed: 3 additions & 2 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/buttons/preview.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,11 @@ export default class Preview extends PreviewCollection {
227227
let buttonResizeValue: string|number = "";
228228
if (this.parent.dataStore.get("is_same_width") === "true") {
229229
if (buttonItems.length > 0) {
230+
buttonItems.css("min-width", "");
230231
const currentLargestButton = this.findLargestButton(buttonItems);
231-
buttonResizeValue = currentLargestButton.css("min-width", "").outerWidth();
232+
buttonResizeValue = currentLargestButton.outerWidth();
232233
}
233234
}
234-
235235
buttonItems.css("min-width", buttonResizeValue);
236236
}
237237
}
@@ -251,7 +251,6 @@ export default class Preview extends PreviewCollection {
251251
largestButton = buttonElement;
252252
}
253253
});
254-
255254
return largestButton;
256255
}
257256

@@ -266,7 +265,6 @@ export default class Preview extends PreviewCollection {
266265
const calculatedButtonWidth: number = widthProperties.reduce((accumulatedWidth, widthProperty): number => {
267266
return accumulatedWidth + (parseInt(buttonItem.css(widthProperty), 10) || 0);
268267
}, buttonItem.find("[data-element='link_text']").width());
269-
270268
return calculatedButtonWidth;
271269
}
272270
}

0 commit comments

Comments
 (0)