Skip to content

Commit 6f599f3

Browse files
committed
MC-4189: IE11 - PageBuilder Does Not Load
- Fix panel error
1 parent b79e6d6 commit 6f599f3

File tree

2 files changed

+46
-42
lines changed

2 files changed

+46
-42
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/panel.js

Lines changed: 23 additions & 21 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/panel.ts

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -140,34 +140,36 @@ export default class Panel implements PanelInterface {
140140
const panel = $(this.element);
141141
const stage = panel.siblings(".pagebuilder-stage");
142142
$(window).scroll(function() {
143-
const panelOffsetTop = panel.offset().top;
144-
const stageOffsetTop = stage.offset().top;
145-
const panelHeight = panel.outerHeight();
146-
const stageHeight = stage.outerHeight();
147-
const currentPanelBottom = Math.round(panelOffsetTop + panel.outerHeight(true) - $(this).scrollTop());
148-
const currentStageBottom = Math.round(stageOffsetTop + stage.outerHeight(true) - $(this).scrollTop());
149-
const currentPanelTop = Math.round(panelOffsetTop - $(this).scrollTop());
150-
const currentStageTop = Math.round(stageOffsetTop - $(this).scrollTop());
151-
// When panel height is less than stage, begin stickiness
152-
if (panelHeight <= stageHeight && pageActions.hasClass("_fixed")) {
153-
const pageActionsHeight = pageActions.outerHeight() + 15;
154-
// When scroll reaches top of stage, stick panel to top
155-
if (currentStageTop <= pageActionsHeight) {
156-
// When panel reaches bottom of stage, stick panel to bottom of stage
157-
if (currentPanelBottom >= currentStageBottom && currentPanelTop <= pageActionsHeight) {
158-
self.isStickyBottom(true);
159-
self.isStickyTop(false);
143+
if (panel && panel.offset()) {
144+
const panelOffsetTop = panel.offset().top;
145+
const stageOffsetTop = stage.offset().top;
146+
const panelHeight = panel.outerHeight();
147+
const stageHeight = stage.outerHeight();
148+
const currentPanelBottom = Math.round(panelOffsetTop + panel.outerHeight(true) - $(this).scrollTop());
149+
const currentStageBottom = Math.round(stageOffsetTop + stage.outerHeight(true) - $(this).scrollTop());
150+
const currentPanelTop = Math.round(panelOffsetTop - $(this).scrollTop());
151+
const currentStageTop = Math.round(stageOffsetTop - $(this).scrollTop());
152+
// When panel height is less than stage, begin stickiness
153+
if (panelHeight <= stageHeight && pageActions.hasClass("_fixed")) {
154+
const pageActionsHeight = pageActions.outerHeight() + 15;
155+
// When scroll reaches top of stage, stick panel to top
156+
if (currentStageTop <= pageActionsHeight) {
157+
// When panel reaches bottom of stage, stick panel to bottom of stage
158+
if (currentPanelBottom >= currentStageBottom && currentPanelTop <= pageActionsHeight) {
159+
self.isStickyBottom(true);
160+
self.isStickyTop(false);
161+
} else {
162+
self.isStickyBottom(false);
163+
self.isStickyTop(true);
164+
}
160165
} else {
161166
self.isStickyBottom(false);
162-
self.isStickyTop(true);
167+
self.isStickyTop(false);
163168
}
164169
} else {
165170
self.isStickyBottom(false);
166171
self.isStickyTop(false);
167172
}
168-
} else {
169-
self.isStickyBottom(false);
170-
self.isStickyTop(false);
171173
}
172174
});
173175
}

0 commit comments

Comments
 (0)