Skip to content

Commit 27ce4d2

Browse files
committed
MC-4132: Couldn't open PageBuilder on Product Schedule Update page
- Resolve issue with animation on slide out modals when within Page Builder
1 parent b5d921b commit 27ce4d2

File tree

2 files changed

+47
-19
lines changed

2 files changed

+47
-19
lines changed

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
// * See COPYING.txt for license details.
44
// */
55

6-
7-
.modal-slide .modal-inner-wrap {
8-
&.un-transform {
9-
transform: none;
10-
transition: none;
11-
}
12-
}
13-
146
.modal-popup .modal-dnsa {
157
padding: 2.4rem 0 0;
168

app/code/Magento/PageBuilder/view/adminhtml/web/js/form/element/wysiwyg.js

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ define([
99
'mage/translate',
1010
'Magento_PageBuilder/js/events',
1111
'Magento_PageBuilder/js/page-builder'
12-
], function (jquery, Wysiwyg, $t, events, PageBuilder) {
12+
], function ($, Wysiwyg, $t, events, PageBuilder) {
1313
'use strict';
1414

1515
/**
@@ -22,10 +22,14 @@ define([
2222
visiblePageBuilder: false,
2323
isComponentInitialized: false,
2424
wysiwygConfigData: {},
25-
pageBuilderEditButtonText: $t('Edit with Page Builder')
25+
pageBuilderEditButtonText: $t('Edit with Page Builder'),
26+
isWithinModal: false,
27+
modal: false,
2628
},
2729

28-
/** @inheritdoc */
30+
/**
31+
* @inheritdoc
32+
*/
2933
initialize: function () {
3034
this._super();
3135

@@ -36,21 +40,35 @@ define([
3640
return this;
3741
},
3842

39-
/** @inheritdoc */
43+
/**
44+
* @inheritdoc
45+
*/
4046
initObservable: function () {
4147
this._super()
4248
.observe('visiblePageBuilder wysiwygConfigData loading');
4349

4450
return this;
4551
},
4652

47-
/** Handle button click. */
48-
pageBuilderEditButtonClick: function () {
53+
/**
54+
* Handle button click, init the Page Builder application
55+
*/
56+
pageBuilderEditButtonClick: function (context, event) {
57+
var modalInnerWrap = $(event.currentTarget).parents(".modal-inner-wrap");
58+
59+
// Determine if the Page Builder instance is within a modal
60+
this.isWithinModal = modalInnerWrap.length === 1;
61+
if (this.isWithinModal) {
62+
this.modal = modalInnerWrap;
63+
}
64+
4965
this.initPageBuilder();
5066
this.toggleFullScreen();
5167
},
5268

53-
/** Init PageBuilder. */
69+
/**
70+
* Init Page Builder
71+
*/
5472
initPageBuilder: function () {
5573
if (!this.isComponentInitialized) {
5674
this.loading(true);
@@ -63,29 +81,47 @@ define([
6381
}
6482
},
6583

66-
/** Toggle PageBuilder full screen. */
84+
/**
85+
* Toggle Page Builder full screen mode
86+
*/
6787
toggleFullScreen: function () {
6888
events.trigger('stage:' + this.pageBuilder.id + ':toggleFullscreen', {});
6989
},
7090

71-
/** Init listeners of stage. */
91+
/**
92+
* Init various listeners on the stage
93+
*/
7294
initPageBuilderListeners: function () {
7395
var id = this.pageBuilder.id;
7496

7597
events.on('stage:' + id + ':readyAfter', function () {
7698
this.isComponentInitialized = true;
7799
this.loading(false);
78100
}.bind(this));
101+
79102
events.on('stage:' + id + ':masterFormatRenderAfter', function (args) {
80103
this.value(args.value);
81104
}.bind(this));
105+
82106
events.on('stage:' + id + ':fullScreenModeChangeAfter', function (args) {
83107
if (!args.fullScreen && this.wysiwygConfigData()['pagebuilder_button']) {
84108
this.visiblePageBuilder(false);
85-
jquery('.modal-inner-wrap').removeClass('un-transform');
109+
110+
if (this.isWithinModal && this.modal) {
111+
this.modal.css({
112+
transform: "",
113+
transition: ""
114+
});
115+
}
86116
} else if (args.fullScreen && this.wysiwygConfigData()['pagebuilder_button']) {
87117
this.visiblePageBuilder(true);
88-
jquery('.modal-inner-wrap').addClass('un-transform');
118+
119+
if (this.isWithinModal && this.modal) {
120+
this.modal.css({
121+
transform: "none",
122+
transition: "none"
123+
});
124+
}
89125
}
90126
}.bind(this));
91127
}

0 commit comments

Comments
 (0)