Skip to content

Commit f8cf236

Browse files
committed
MC-5423: Scheduled Update slide out issues
- Add transitions for content margins and left panel height changes
1 parent c46db31 commit f8cf236

File tree

4 files changed

+48
-13
lines changed

4 files changed

+48
-13
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_page-builder.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@
165165
}
166166

167167
.pagebuilder-stage {
168+
-moz-transition: margin-left .35s ease-in-out;
169+
-webkit-transition: margin-left .35s ease-in-out;
168170
-moz-user-select: none;
169171
-ms-user-select: none;
170172
-o-user-select: none;
@@ -175,6 +177,7 @@
175177
min-height: 200px;
176178
padding: 0;
177179
user-select: none;
180+
transition: margin-left .35s ease-in-out;
178181

179182
&.stage-full-screen {
180183
background: @color-black;

app/code/Magento/PageBuilder/view/adminhtml/web/css/source/_panel.less

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,15 +110,14 @@
110110
}
111111

112112
.pagebuilder-panel {
113-
-moz-transition: .4s;
114-
-moz-user-select: none; /* Firefox */
115-
-ms-user-select: none; /* IE10+ */
116-
/* Rules below not implemented in browsers yet */
113+
-moz-transition: .4s ease-in-out;
114+
-moz-user-select: none;
115+
-ms-user-select: none;
117116
-o-user-select: none;
118-
-webkit-transition: .4s;
119-
-webkit-user-select: none; /* Chrome/Safari */
117+
-webkit-transition: .4s ease-in-out;
118+
-webkit-user-select: none;
120119
background: @color-very-dark-grayish-orange;
121-
transition: .4s;
120+
transition: .4s ease-in-out;
122121
user-select: none;
123122

124123
.search-results-empty {

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

Lines changed: 20 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/ts/js/page-builder.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default class PageBuilder implements PageBuilderInterface {
2525
public loading: KnockoutObservable<boolean> = ko.observable(true);
2626
public wrapperStyles: KnockoutObservable<{[key: string]: string}> = ko.observable({});
2727
private previousWrapperStyles: {[key: string]: string} = {};
28+
private previousPanelHeight: number;
2829

2930
constructor(config: any, initialValue: string) {
3031
Config.setConfig(config);
@@ -50,8 +51,15 @@ export default class PageBuilder implements PageBuilderInterface {
5051
public toggleFullScreen(): void {
5152
const stageWrapper = $("#" + this.stage.id).parent();
5253
const pageBuilderWrapper = stageWrapper.parents(".pagebuilder-wysiwyg-wrapper");
54+
const panel = stageWrapper.find(".pagebuilder-panel");
5355
if (!this.isFullScreen()) {
54-
pageBuilderWrapper.height(pageBuilderWrapper.height());
56+
pageBuilderWrapper.height(pageBuilderWrapper.outerHeight());
57+
this.previousPanelHeight = panel.outerHeight();
58+
panel.css("height", this.previousPanelHeight + "px");
59+
/**
60+
* Fix the stage in the exact place it is when it's part of the content and allow it to transition to full
61+
* screen.
62+
*/
5563
this.previousWrapperStyles = {
5664
'position': 'fixed',
5765
'top': parseInt(stageWrapper.offset().top.toString(), 10) -
@@ -61,23 +69,31 @@ export default class PageBuilder implements PageBuilderInterface {
6169
'width': stageWrapper.outerWidth().toString() + 'px'
6270
};
6371
this.wrapperStyles(this.previousWrapperStyles);
64-
this.isFullScreen(!this.isFullScreen());
72+
this.isFullScreen(true);
6573
_.defer(() => {
74+
// Remove all styles we applied to fix the position once we're transitioning
75+
panel.css("height", "");
6676
this.wrapperStyles(Object.keys(this.previousWrapperStyles)
6777
.reduce((object: object, styleName: string) => {
6878
return Object.assign(object, {[styleName]: ""});
6979
}, {})
7080
);
7181
});
7282
} else {
83+
// When leaving full screen mode just transition back to the original state
7384
this.wrapperStyles(this.previousWrapperStyles);
85+
this.isFullScreen(false);
86+
panel.css("height", this.previousPanelHeight + "px");
87+
// Wait for the 350ms animation to complete before changing these properties back
7488
_.delay(() => {
75-
this.isFullScreen(!this.isFullScreen());
89+
panel.css("height", "");
7690
this.wrapperStyles(Object.keys(this.previousWrapperStyles)
7791
.reduce((object: object, styleName: string) => {
7892
return Object.assign(object, {[styleName]: ""});
7993
}, {})
8094
);
95+
this.previousWrapperStyles = {};
96+
this.previousPanelHeight = null;
8197
}, 350);
8298
}
8399
}

0 commit comments

Comments
 (0)