Skip to content

Commit 3a210e5

Browse files
committed
MC-3392: Hide Content block/ container from the stage
- Fix tabs broken by improvements from mainline
1 parent 29c0d9e commit 3a210e5

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

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

Lines changed: 13 additions & 1 deletion
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/stage.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/ts/js/content-type/tabs/preview.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ export default class Preview extends PreviewCollection {
108108
this.updateData("default_active", newDefaultActiveTab);
109109
}
110110
});
111+
112+
// Monitor focus tab to start / stop interaction on the stage, debounce to avoid duplicate calls
113+
this.focusedTab.subscribe(_.debounce((index: number) => {
114+
if (index !== null) {
115+
events.trigger("stage:interactionStart");
116+
} else {
117+
// We have to force the stop as the event firing is inconsistent for certain operations
118+
events.trigger("stage:interactionStop", {force : true});
119+
}
120+
}, 1));
111121
}
112122

113123
/**

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/stage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ export default class Stage {
181181
++interactionLevel;
182182
this.interacting(true);
183183
});
184-
events.on("stage:interactionStop", () => {
185-
if (--interactionLevel === 0) {
184+
events.on("stage:interactionStop", (args: {force: boolean}) => {
185+
if (--interactionLevel === 0 || (_.isObject(args) && args.force === true)) {
186186
this.interacting(false);
187187
}
188188
});

0 commit comments

Comments
 (0)