Skip to content

Commit 7c0f013

Browse files
committed
MC-2333: UX Review
- Refactored state logic
1 parent 86d55ba commit 7c0f013

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

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

Lines changed: 0 additions & 12 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/content-type/block/default/preview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="pagebuilder-content-type pagebuilder-block" event="{ mouseover: onMouseOver, mouseout: onMouseOut }, mouseoverBubble: false">
99
<div attr="data.main.attributes" ko-style="data.main.style" css="data.main.css">
1010
<div if="displayPreview" class="rendered-content" html="data.main.html"></div>
11-
<div if="displayPlaceholder" class="pagebuilder-block-placeholder">
11+
<div ifnot="displayPreview" class="pagebuilder-block-placeholder">
1212
<span class="placeholder-text" text="placeholderText"/>
1313
</div>
1414
</div>

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import BasePreview from "../preview";
1616

1717
export default class Preview extends BasePreview {
1818
public displayPreview: KnockoutObservable<boolean> = ko.observable(false);
19-
public displayPlaceholder: KnockoutObservable<boolean> = ko.observable(false);
2019
public loading: KnockoutObservable<boolean> = ko.observable(false);
2120
public placeholderText: KnockoutObservable<string>;
2221
private lastBlockId: number;
@@ -69,17 +68,14 @@ export default class Preview extends BasePreview {
6968
if (this.lastRenderedHtml) {
7069
this.data.main.html(this.lastRenderedHtml);
7170
this.displayPreview(true);
72-
this.displayPlaceholder(false);
7371
}
7472
} else {
7573
this.displayPreview(false);
76-
this.displayPlaceholder(true);
7774
this.placeholderText("");
7875
}
7976

8077
if (!data.block_id || data.template.length === 0) {
8178
this.displayPreview(false);
82-
this.displayPlaceholder(true);
8379
this.placeholderText(this.messages.NOT_SELECTED);
8480

8581
return;
@@ -105,7 +101,6 @@ export default class Preview extends BasePreview {
105101
// Empty content means something bad happened in the controller that didn't trigger a 5xx
106102
if (typeof response.data !== "object") {
107103
this.displayPreview(false);
108-
this.displayPlaceholder(true);
109104
this.placeholderText(this.messages.UNKNOWN_ERROR);
110105

111106
return;
@@ -116,11 +111,9 @@ export default class Preview extends BasePreview {
116111

117112
if (response.data.content) {
118113
this.displayPreview(true);
119-
this.displayPlaceholder(false);
120114
this.data.main.html(response.data.content);
121115
} else if (response.data.error) {
122116
this.displayPreview(false);
123-
this.displayPlaceholder(true);
124117
this.placeholderText(response.data.error);
125118
}
126119

@@ -130,7 +123,6 @@ export default class Preview extends BasePreview {
130123
})
131124
.fail(() => {
132125
this.displayPreview(false);
133-
this.displayPlaceholder(true);
134126
this.placeholderText(this.messages.UNKNOWN_ERROR);
135127
})
136128
.always(() => {

0 commit comments

Comments
 (0)