Skip to content

Commit 5334c16

Browse files
author
Lukasz Borowiec
committed
Merge branch '514_content-snapshot-category-admin-page' into 511_content-snapshot-product-admin-page
2 parents 174f238 + 18ebb55 commit 5334c16

File tree

11 files changed

+101
-20
lines changed

11 files changed

+101
-20
lines changed

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

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
@wysiwyg-overlay-border: #4181e4;
99

1010
.pagebuilder-header {
11-
display: none;
1211
opacity: 0;
1312
text-align: right;
1413

@@ -23,12 +22,21 @@
2322
}
2423

2524
&.visible {
26-
display: block;
2725
opacity: 1;
2826
visibility: visible;
2927
}
3028
}
3129

30+
.pagebuilder_content_snapshot {
31+
.pagebuilder-header {
32+
display: none;
33+
34+
&.visible {
35+
display: block;
36+
}
37+
}
38+
}
39+
3240
.admin__fieldset > .admin__field > .admin__control-grouped {
3341
&.pagebuilder-active {
3442
float: left;
@@ -50,6 +58,22 @@
5058
pointer-events: none;
5159
}
5260

61+
&.pagebuilder_content_snapshot {
62+
&.stage-full-screen {
63+
.pagebuilder-header {
64+
display: block;
65+
66+
&.visible {
67+
display: block;
68+
}
69+
}
70+
71+
.pagebuilder-canvas {
72+
padding-bottom: 120px;
73+
}
74+
}
75+
}
76+
5377
&.stage-full-screen {
5478
-moz-transform: translateZ(0);
5579
-webkit-transform: translateZ(0);
@@ -71,7 +95,6 @@
7195
background: @color-very-dark-grayish-orange;
7296
border: none;
7397
border-bottom: 1px solid @color-brownie-almost;
74-
display: block;
7598
left: 150px;
7699
opacity: 0;
77100
padding: 0;
@@ -96,14 +119,12 @@
96119
}
97120

98121
&.visible {
99-
display: block;
100122
opacity: 1;
101123
visibility: visible;
102124
}
103125
}
104126

105127
.pagebuilder-canvas {
106-
padding-bottom: 120px;
107128
padding-top: 30px;
108129
}
109130

@@ -217,15 +238,18 @@
217238
}
218239

219240
.pagebuilder-stage {
241+
-moz-transition: margin-left .35s ease-in-out;
220242
-moz-user-select: none;
221243
-ms-user-select: none;
222244
-o-user-select: none;
245+
-webkit-transition: margin-left .35s ease-in-out;
223246
-webkit-user-select: none;
224247
font-size: 0;
248+
margin-left: 170px;
225249
min-height: 200px;
226250
padding: 0;
251+
transition: margin-left .35s ease-in-out;
227252
user-select: none;
228-
229253
&.stage-full-screen {
230254
background: @color-black;
231255
}
@@ -259,7 +283,7 @@
259283
-moz-transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
260284
-webkit-transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
261285
opacity: 0;
262-
padding-top: 8px;
286+
padding-bottom: 120px;
263287
transition: opacity .75s ease-in-out, visibility .75s ease-in-out;
264288
visibility: hidden;
265289

@@ -283,6 +307,21 @@
283307
}
284308
}
285309

310+
.pagebuilder_content_snapshot {
311+
.pagebuilder-stage {
312+
-moz-transition: none;
313+
-webkit-transition: none;
314+
margin-left: auto;
315+
transition: none;
316+
317+
.pagebuilder-canvas {
318+
padding-bottom: 0;
319+
padding-top: 8px;
320+
}
321+
322+
}
323+
}
324+
286325
.pagebuilder-row-wrapper,
287326
.pagebuilder-structure-wrapper {
288327
display: inline-block;

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

Lines changed: 11 additions & 0 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/preview.js

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

Lines changed: 1 addition & 0 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/panel.js

Lines changed: 2 additions & 0 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/template/page-builder.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
-->
77
<div class="pagebuilder-stage-wrapper"
8-
css="'stage-full-screen': isFullScreen"
8+
css="'stage-full-screen': isFullScreen,'pagebuilder_content_snapshot': !panel.isVisible()"
99
ko-style="wrapperStyles">
1010
<div class="admin__field pagebuilder-header" css="visible: panel.isVisible()">
1111
<button type="button" translate="'Apply Template'" if="isAllowedTemplateApply" click="toggleTemplateManger"/>

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import _ from "underscore";
7-
import ConfigInterface, {Mode, ContentSnapshotInterface} from "./config.types";
7+
import ConfigInterface, {ContentSnapshotInterface, Mode} from "./config.types";
88
import ContentTypeConfigInterface from "./content-type-config.types";
99

1010
export default class Config {
@@ -45,12 +45,23 @@ export default class Config {
4545
Config.contentSnapshot = contentSnapshot;
4646
}
4747

48+
/**
49+
* Set the content snapshot flag to inform other components about fullscreen mode
50+
* when page builder is enabled
51+
*
52+
* @param flag
53+
*/
54+
public static setContentSnapshotFullScreenMode(flag: boolean): void
55+
{
56+
Config.contentSnapshot.isFullScreen = flag;
57+
}
58+
4859
/**
4960
* Retrieve the current instances mode
5061
*/
5162
public static getContentSnapshot(): ContentSnapshotInterface
5263
{
53-
return Config.contentSnapshot
64+
return Config.contentSnapshot;
5465
}
5566

5667
/**

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/config.types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ export type ContentSnapshot = true | false;
2323

2424
export interface ContentSnapshotInterface
2525
{
26-
pageBuilderId: string,
27-
contentSnapshotMode: ContentSnapshot,
26+
pageBuilderId: string;
27+
isFullScreen: boolean;
28+
contentSnapshotMode: ContentSnapshot;
2829
}
2930

3031
export interface MenuSectionInterface {

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import _ from "underscore";
1212
import "../binding/live-edit";
1313
import "../binding/sortable";
1414
import "../binding/sortable-children";
15-
import ContentTypeCollection from "../content-type-collection";
1615
import Config from "../config";
16+
import ContentTypeCollection from "../content-type-collection";
1717
import ContentTypeCollectionInterface from "../content-type-collection.types";
1818
import ContentTypeConfigInterface, {ConfigFieldInterface} from "../content-type-config.types";
1919
import createContentType from "../content-type-factory";
@@ -91,7 +91,7 @@ export default class Preview implements PreviewInterface {
9191
"empty-placeholder-background": this.isPlaceholderVisible,
9292
});
9393

94-
if (Config.getContentSnapshot().contentSnapshotMode) {
94+
if (Config.getContentSnapshot().contentSnapshotMode && !Config.getContentSnapshot().isFullScreen) {
9595
this.accessibility(false);
9696
}
9797

@@ -499,6 +499,9 @@ export default class Preview implements PreviewInterface {
499499
* Bind events
500500
*/
501501
protected bindEvents() {
502+
const pageBuilderId = Config.getContentSnapshot().pageBuilderId;
503+
const fullScreenModeChangeAfterEvent = `stage:${pageBuilderId}:fullScreenModeChangeAfter`;
504+
502505
this.contentType.dataStore.subscribe(
503506
(data: DataObject) => {
504507
this.updateObservables();
@@ -515,7 +518,8 @@ export default class Preview implements PreviewInterface {
515518
},
516519
);
517520
}
518-
events.on(`stage:${Config.getContentSnapshot().pageBuilderId}:fullScreenModeChangeAfter`, this.toggleAccessibility.bind(this));
521+
522+
events.on(fullScreenModeChangeAfterEvent, this.toggleAccessibility.bind(this));
519523
}
520524

521525
/**
@@ -648,6 +652,7 @@ export default class Preview implements PreviewInterface {
648652
{
649653
if (Config.getContentSnapshot().contentSnapshotMode) {
650654
this.accessibility(args.fullScreen);
655+
Config.setContentSnapshotFullScreenMode(args.fullScreen);
651656
}
652657
}
653658
}

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ export default class PageBuilder implements PageBuilderInterface {
4343
constructor(config: any, initialValue: string, contentSnapshot: boolean) {
4444
Config.setConfig(config);
4545
Config.setMode("Preview");
46-
Config.setContentSnapshot({pageBuilderId: this.id, contentSnapshotMode: contentSnapshot});
46+
Config.setContentSnapshot(
47+
{
48+
pageBuilderId: this.id,
49+
isFullScreen: config.isFullScreen,
50+
contentSnapshotMode: contentSnapshot,
51+
},
52+
);
4753
this.preloadTemplates(config);
4854
this.initialValue = initialValue;
4955
this.isFullScreen(config.isFullScreen);

0 commit comments

Comments
 (0)