Skip to content

Commit a7ab7c4

Browse files
author
joiecaquicla
committed
magento2/magento2-page-builder#636: Responsive breakpoint switcher - applied fixes to background image issue on banner and row, minor changes on block, image, and product content type preview.js
1 parent c197d61 commit a7ab7c4

File tree

7 files changed

+31
-86
lines changed

7 files changed

+31
-86
lines changed

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

Lines changed: 1 addition & 14 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/content-type/block/preview.js

Lines changed: 2 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/js/content-type/image/preview.js

Lines changed: 10 additions & 10 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/content-type/products/preview.js

Lines changed: 16 additions & 19 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/content-type/row/preview.js

Lines changed: 1 addition & 14 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/banner/preview.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,7 @@ export default class Preview extends BasePreview {
103103
private buildJarallax = _.debounce(() => {
104104
// Destroy all instances of the plugin prior
105105
try {
106-
// store/apply correct style after destroying, as jarallax incorrectly overrides it with stale value
107-
const style = this.wrapper.getAttribute("style") ||
108-
this.wrapper.getAttribute("data-jarallax-original-styles");
109-
const backgroundImage = this.getBackgroundImage();
110106
jarallax(this.wrapper, "destroy");
111-
this.wrapper.setAttribute("style", style);
112-
if (this.contentType.dataStore.get("background_type") as string !== "video" &&
113-
this.wrapper.style.backgroundImage !== backgroundImage &&
114-
backgroundImage !== "none"
115-
) {
116-
this.wrapper.style.backgroundImage = backgroundImage;
117-
}
118107
} catch (e) {
119108
// Failure of destroying is acceptable
120109
}
@@ -531,9 +520,7 @@ export default class Preview extends BasePreview {
531520
this.contentType.dataStore.set("background_type", "image");
532521
});
533522
events.on(`stage:${this.contentType.stageId}:viewportChangeAfter`, (args: {viewport: string}) => {
534-
if (this.contentType.dataStore.get("background_type") === "video") {
535523
this.buildJarallax();
536-
}
537524
});
538525
}
539526

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

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,7 @@ export default class Preview extends PreviewCollection {
3636
private buildJarallax = _.debounce(() => {
3737
// Destroy all instances of the plugin prior
3838
try {
39-
// store/apply correct style after destroying, as jarallax incorrectly overrides it with stale value
40-
const style = this.element.getAttribute("style") ||
41-
this.element.getAttribute("data-jarallax-original-styles");
42-
const backgroundImage = this.getBackgroundImage();
4339
jarallax(this.element, "destroy");
44-
this.element.setAttribute("style", style);
45-
if (this.contentType.dataStore.get("background_type") as string !== "video" &&
46-
this.element.style.backgroundImage !== backgroundImage &&
47-
backgroundImage !== "none"
48-
) {
49-
this.element.style.backgroundImage = backgroundImage;
50-
}
5140
} catch (e) {
5241
// Failure of destroying is acceptable
5342
}
@@ -144,9 +133,7 @@ export default class Preview extends PreviewCollection {
144133
this.toggleFullScreen.bind(this),
145134
);
146135
events.on(`stage:${this.contentType.stageId}:viewportChangeAfter`, (args: {viewport: string}) => {
147-
if (this.contentType.dataStore.get("background_type") === "video") {
148-
this.buildJarallax();
149-
}
136+
this.buildJarallax();
150137
});
151138
}
152139

0 commit comments

Comments
 (0)