Skip to content

Commit 669e0ad

Browse files
#514: User sees content snapshot on Category Page in Admin Panel
- fix uploader initialization sequence - add animation - add snapshot to staging update form
1 parent f2ac76e commit 669e0ad

File tree

8 files changed

+65
-22
lines changed

8 files changed

+65
-22
lines changed

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

Lines changed: 6 additions & 5 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/image/preview.js

Lines changed: 10 additions & 5 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/slide/preview.js

Lines changed: 20 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/js/form/element/wysiwyg.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ define([
189189
*/
190190
toggleFullScreen: function () {
191191
events.trigger('stage:' + this.pageBuilder.id + ':toggleFullscreen', {
192-
animate: false
192+
animate: !!this.wysiwygConfigData()['pagebuilder_content_snapshot']
193193
});
194194
},
195195

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
@@ -12,7 +12,7 @@
1212
if="!isSnapshot()">
1313
<button type="button" translate="'Apply Template'" if="isAllowedTemplateApply" click="toggleTemplateManger"/>
1414
<button type="button" translate="'Save as Template'" if="isAllowedTemplateSave" click="saveAsTemplate"/>
15-
<i click="function() { toggleFullScreen($element); }"
15+
<i click="function() { toggleFullScreen({animate:true}); }"
1616
css="'icon-pagebuilder-fullscreen': !isFullScreen(), 'icon-pagebuilder-fullscreen-exit': isFullScreen()"
1717
attr="{title: isFullScreen() ? $t('Close Full Screen') : $t('Open in Full Screen')}">
1818
</i>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,10 @@ export default class Preview extends BasePreview {
486486
events.on("banner:mountAfter", (args: ContentTypeReadyEventParamsInterface) => {
487487
if (args.id === this.contentType.id) {
488488
this.buildJarallax();
489+
this.isSnapshot.subscribe((value) => {
490+
this.changeUploaderControlsVisibility();
491+
});
492+
this.changeUploaderControlsVisibility();
489493
}
490494
});
491495
events.on(`${this.config.name}:${this.contentType.id}:updateAfter`, () => {
@@ -506,10 +510,6 @@ export default class Preview extends BasePreview {
506510
events.on(`image:${this.contentType.id}:uploadAfter`, () => {
507511
this.contentType.dataStore.set("background_type", "image");
508512
});
509-
this.isSnapshot.subscribe((value) => {
510-
this.changeUploaderControlsVisibility();
511-
});
512-
this.changeUploaderControlsVisibility();
513513
}
514514

515515
/**

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

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

6+
import {ContentTypeReadyEventParamsInterface} from "Magento_PageBuilder/js/content-type/content-type-events.types";
67
import events from "Magento_PageBuilder/js/events";
78
import HideShowOption from "../../content-type-menu/hide-show-option";
89
import {OptionsInterface} from "../../content-type-menu/option.types";
@@ -58,6 +59,15 @@ export default class Preview extends BasePreview {
5859
protected bindEvents() {
5960
super.bindEvents();
6061

62+
events.on("image:mountAfter", (args: ContentTypeReadyEventParamsInterface) => {
63+
if (args.id === this.contentType.id) {
64+
this.isSnapshot.subscribe((value) => {
65+
this.changeUploaderControlsVisibility();
66+
});
67+
this.changeUploaderControlsVisibility();
68+
}
69+
});
70+
6171
events.on(`${this.config.name}:${this.contentType.id}:updateAfter`, () => {
6272
const files = this
6373
.contentType
@@ -66,10 +76,6 @@ export default class Preview extends BasePreview {
6676
const imageObject: object = files ? (files[0] as object) : {};
6777
events.trigger(`image:${this.contentType.id}:assignAfter`, imageObject);
6878
});
69-
this.isSnapshot.subscribe((value) => {
70-
this.changeUploaderControlsVisibility();
71-
});
72-
this.changeUploaderControlsVisibility();
7379
}
7480

7581
/**

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ export default class Preview extends BasePreview {
480480
events.on("slide:mountAfter", (args: ContentTypeReadyEventParamsInterface) => {
481481
if (args.id === this.contentType.id) {
482482
this.buildJarallax();
483+
this.isSnapshot.subscribe((value) => {
484+
this.changeUploaderControlsVisibility();
485+
});
486+
this.changeUploaderControlsVisibility();
483487
}
484488
});
485489

@@ -541,6 +545,15 @@ export default class Preview extends BasePreview {
541545
});
542546
}
543547

548+
/**
549+
* Change uploader controls visibility
550+
*/
551+
private changeUploaderControlsVisibility() {
552+
this.getUploader().getUiComponent()((uploader: any) => {
553+
uploader.visibleControls = !this.isSnapshot();
554+
});
555+
}
556+
544557
/**
545558
* Update image data inside data store
546559
*

0 commit comments

Comments
 (0)