Skip to content

Commit eff8896

Browse files
committed
MC-3732: Buttons Do Not Display As Same Width After Page Refresh When There's A Lot Of Page Content
- refactor fix to make more efficient
1 parent 23f040a commit eff8896

File tree

2 files changed

+15
-13
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+15
-13
lines changed

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

Lines changed: 6 additions & 6 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: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import createContentType from "../../content-type-factory";
1515
import Option from "../../content-type-menu/option";
1616
import OptionInterface from "../../content-type-menu/option.d";
1717
import StageUpdateAfterParamsInterface from "../../stage-update-after-params.d";
18-
import ContentTypeDroppedCreateEventParamsInterface from "../content-type-dropped-create-event-params";
18+
import ContentTypeAfterRenderEventParamsInterface from "../content-type-after-render-event-params.d";
19+
import ContentTypeDroppedCreateEventParamsInterface from "../content-type-dropped-create-event-params.d";
1920
import PreviewCollection from "../preview-collection";
2021

2122
/**
@@ -44,15 +45,16 @@ export default class Preview extends PreviewCollection {
4445
}
4546
});
4647

47-
events.on("buttons:renderAfter", (args: ContentTypeDroppedCreateEventParamsInterface) => {
48-
_.debounce(() => {
48+
events.on("buttons:renderAfter", (eventData: ContentTypeAfterRenderEventParamsInterface) => {
49+
if (eventData.contentType.id === this.parent.id) {
4950
this.resizeChildButtons();
50-
}, 500).call(this);
51+
}
5152
});
52-
events.on("button-item:renderAfter", (args: ContentTypeDroppedCreateEventParamsInterface) => {
53-
_.debounce(() => {
53+
54+
events.on("button-item:renderAfter", (eventData: ContentTypeAfterRenderEventParamsInterface) => {
55+
if (eventData.contentType.parent.id === this.parent.id) {
5456
this.resizeChildButtons();
55-
}, 500).call(this);
57+
}
5658
});
5759

5860
events.on("stage:updateAfter", (eventData: StageUpdateAfterParamsInterface) => {

0 commit comments

Comments
 (0)