Skip to content

Commit aea1d8b

Browse files
author
joiecaquicla
committed
magento2/magento2-page-builder#636: Responsive breakpoint switcher - applied additional fixes for product content type carousel appearance issue
1 parent a11dd69 commit aea1d8b

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

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

Lines changed: 5 additions & 3 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/js/page-builder.js

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ export default class Preview extends BasePreview {
7777
});
7878

7979
events.on(`stage:${this.contentType.stageId}:viewportChangeAfter`, (args: {viewport: string}) => {
80-
const viewports = Config.getConfig("breakpoints");
81-
this.slidesToShow = parseFloat(viewports[args.viewport].options.products.default.slidesToShow);
82-
this.destroySlider();
83-
this.initSlider();
80+
const viewports = Config.getConfig("viewports");
81+
if (this.element && this.appearance() === "carousel") {
82+
this.slidesToShow = parseFloat(viewports[args.viewport].options.products.default.slidesToShow);
83+
this.destroySlider();
84+
this.initSlider();
85+
}
8486
});
8587
}
8688

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/page-builder.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,17 +255,17 @@ export default class PageBuilder implements PageBuilderInterface {
255255
const previousViewport = this.viewport();
256256

257257
this.viewport(viewport);
258+
_.each(this.viewportClasses, (viewportClass) => {
259+
viewportClass(false);
260+
});
261+
this.viewportClasses[`${viewport}-viewport`](true);
258262
Config.setConfig({
259263
viewport,
260264
} as ConfigInterface);
261265
events.trigger(`stage:${this.id}:viewportChangeAfter`, {
262266
viewport,
263267
previousViewport,
264268
});
265-
_.each(this.viewportClasses, (viewportClass) => {
266-
viewportClass(false);
267-
});
268-
this.viewportClasses[`${viewport}-viewport`](true);
269269
}
270270

271271
/**

0 commit comments

Comments
 (0)