Skip to content

Commit becc9c4

Browse files
committed
MC-5691: Implement better developer error reporting
- Revert changes to previewTemplate due to issues caused in rendering of preview
1 parent c33e323 commit becc9c4

File tree

2 files changed

+31
-18
lines changed
  • app/code/Magento/PageBuilder/view/adminhtml/web

2 files changed

+31
-18
lines changed

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

Lines changed: 21 additions & 10 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/preview.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export default class Preview {
4242
public placeholderCss: KnockoutObservable<object>;
4343
public isPlaceholderVisible: KnockoutObservable<boolean> = ko.observable(true);
4444
public isEmpty: KnockoutObservable<boolean> = ko.observable(true);
45-
public previewTemplate: KnockoutObservable<string> = ko.observable();
4645

4746
/**
4847
* @deprecated
@@ -84,11 +83,20 @@ export default class Preview {
8483
"visible": this.isEmpty,
8584
"empty-placeholder-background": this.isPlaceholderVisible,
8685
});
87-
this.previewTemplate(this.getPreviewTemplate());
8886
this.setupDataFields();
8987
this.bindEvents();
9088
}
9189

90+
/**
91+
* Retrieve the preview template
92+
*
93+
* @returns {string}
94+
*/
95+
get previewTemplate(): string {
96+
const appearance = this.previewData.appearance ? this.previewData.appearance() as string : undefined;
97+
return appearanceConfig(this.config.name, appearance).preview_template;
98+
}
99+
92100
/**
93101
* Calls methods by event name.
94102
*
@@ -491,12 +499,6 @@ export default class Preview {
491499

492500
},
493501
);
494-
495-
// If the appearance of the content type changes, update the preview template
496-
this.parent.dataStore.subscribe(() => {
497-
this.previewTemplate(this.getPreviewTemplate());
498-
}, "appearance");
499-
500502
if (this.parent instanceof ContentTypeCollection) {
501503
this.parent.children.subscribe(
502504
(children: any[]) => {

0 commit comments

Comments
 (0)