Skip to content

Commit 234f04b

Browse files
committed
MC-3392: Hide Content block/ container from the stage
- Resolve issues with title option
1 parent 420cc84 commit 234f04b

File tree

5 files changed

+63
-8
lines changed

5 files changed

+63
-8
lines changed

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type-menu/title-option.js

Lines changed: 30 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: 4 additions & 4 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/title.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
*/
66
-->
77

8-
<div data-bind="text: parent.displayLabel" class="option-title"></div>
8+
<div data-bind="text: title" class="option-title"></div>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
import Option from "./option";
7+
import OptionConfigInterface from "./option-config";
8+
import OptionInterface from "./option.d";
9+
10+
export default class TitleOption extends Option implements OptionInterface {
11+
/**
12+
* @param {OptionConfigInterface} options
13+
*/
14+
constructor(
15+
options: OptionConfigInterface,
16+
) {
17+
super(options);
18+
19+
// Modify the icon when changes are made to display in the data store
20+
this.preview.displayLabel.subscribe((label: string) => {
21+
this.title(label);
22+
});
23+
}
24+
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Edit from "../content-type-menu/edit";
2020
import HideShowOption from "../content-type-menu/hide-show-option";
2121
import Option from "../content-type-menu/option";
2222
import {OptionsInterface} from "../content-type-menu/option.d";
23+
import TitleOption from "../content-type-menu/title-option";
2324
import ContentTypeInterface from "../content-type.d";
2425
import {DataObject} from "../data-store";
2526
import {animateContainerHeight, animationTime, lockContainerHeight} from "../drag-drop/container-animation";
@@ -37,7 +38,7 @@ export default class Preview {
3738
public parent: ContentTypeCollectionInterface;
3839
public config: ContentTypeConfigInterface;
3940
public data: ObservableObject = {};
40-
public displayLabel: KnockoutObservable<string>;
41+
public displayLabel: KnockoutObservable<string> = ko.observable();
4142
public display: KnockoutObservable<boolean> = ko.observable(true);
4243
public wrapperElement: Element;
4344

@@ -77,7 +78,7 @@ export default class Preview {
7778
this.edit = new Edit(this.parent, this.parent.dataStore);
7879
this.optionsMenu = new ContentTypeMenu(this, this.retrieveOptions());
7980
this.observableUpdater = observableUpdater;
80-
this.displayLabel = ko.observable(this.config.label);
81+
this.displayLabel(this.config.label);
8182
this.setupDataFields();
8283
this.bindEvents();
8384
}
@@ -383,7 +384,7 @@ export default class Preview {
383384
classes: ["move-structural"],
384385
sort: 10,
385386
}),
386-
title: new Option({
387+
title: new TitleOption({
387388
preview: this,
388389
title: this.config.label,
389390
template: "Magento_PageBuilder/content-type/title",

0 commit comments

Comments
 (0)