Skip to content

Commit 8503675

Browse files
committed
MAGETWO-90441: Allow inline editing of Heading from stage
- move and rename toolbar files
1 parent cebc077 commit 8503675

File tree

9 files changed

+129
-31
lines changed

9 files changed

+129
-31
lines changed

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

Lines changed: 61 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/heading/preview.js

Lines changed: 3 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/toolbar.js

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
import ValueInterface from "./value.d";
7+
8+
export interface OptionInterface {
9+
key: string;
10+
type: string;
11+
options: ValueInterface[];
12+
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/toolbar-options.ts renamed to app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type-toolbar/option.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import ko from "knockout";
77
import Preview from "./content-type/preview";
8-
import ToolbarOptionsValueInterface from "./toolbar-options-value.d";
9-
import ToolbarOptionsInterface from "./toolbar-options.d";
8+
import OptionInterface from "./option.d";
9+
import ValueInterface from "./value.d";
1010

11-
export class ToolbarOptions {
12-
public options: KnockoutObservableArray<ToolbarOptionsInterface> = ko.observableArray([]);
11+
export default class ToolbarOption {
12+
public options: KnockoutObservableArray<OptionInterface> = ko.observableArray([]);
1313
private preview: Preview;
1414

1515
/**
@@ -18,7 +18,7 @@ export class ToolbarOptions {
1818
* @param preview
1919
* @param options
2020
*/
21-
constructor(preview: Preview, options: ToolbarOptionsInterface[]) {
21+
constructor(preview: Preview, options: OptionInterface[]) {
2222
this.preview = preview;
2323
this.options(options);
2424
}
@@ -36,10 +36,10 @@ export class ToolbarOptions {
3636
* Upon clicking the option update the value as directed
3737
* When user toggles the option off, set the value back to default
3838
*
39-
* @param {ToolbarOptionsInterface} option
40-
* @param {ToolbarOptionsValueInterface} value
39+
* @param {OptionInterface} option
40+
* @param {ValueInterface} value
4141
*/
42-
public onClickOption(option: ToolbarOptionsInterface, value: ToolbarOptionsValueInterface) {
42+
public onClickOption(option: OptionInterface, value: ValueInterface) {
4343
const defaultValue: string = this.preview.config.fields[option.key].default;
4444
const currentValue: string = this.preview.previewData[option.key]();
4545
if (currentValue === value.value) {

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/toolbar-options-value.d.ts renamed to app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type-toolbar/value.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
export interface ToolbarOptionsValueInterface {
6+
export interface ValueInterface {
77
value: string;
88
label: string;
99
icon: string;

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ import $ from "jquery";
77
import events from "uiEvents";
88
import _ from "underscore";
99
import ContentTypeConfigInterface from "../../content-type-config.d";
10+
import ToolbarOption from "../../content-type-toolbar/option";
11+
import OptionInterface from "../../content-type-toolbar/option.d";
1012
import ContentTypeInterface from "../../content-type.d";
11-
import {ToolbarOptions, ToolbarOptionsInterface} from "../../toolbar-options";
13+
import Toolbar from "../../toolbar";
1214
import ContentTypeReadyEventParamsInterface from "../content-type-ready-event-params.d";
1315
import ObservableUpdater from "../observable-updater";
1416
import BasePreview from "../preview";
15-
import Toolbar from "../toolbar";
1617

1718
export default class Heading extends BasePreview {
1819
private element: Element;
@@ -60,10 +61,10 @@ export default class Heading extends BasePreview {
6061
/**
6162
* Build and return the tool bar options for heading
6263
*
63-
* @returns {ToolbarOptions}
64+
* @returns {ToolbarOption}
6465
*/
65-
public getHeadingToolbar(): ToolbarOptions {
66-
const options: ToolbarOptionsInterface[] = [
66+
public getHeadingToolbar(): ToolbarOption {
67+
const options: OptionInterface[] = [
6768
{
6869
key: "heading_type",
6970
type: "select",
@@ -123,6 +124,6 @@ export default class Heading extends BasePreview {
123124
},
124125
];
125126

126-
return new ToolbarOptions(this, options);
127+
return new ToolbarOption(this, options);
127128
}
128129
}

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/toolbar-options.d.ts

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/content-type/toolbar.ts renamed to app/code/Magento/PageBuilder/view/adminhtml/web/ts/js/toolbar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import $ from "jquery";
77
import events from "uiEvents";
8-
import Preview from "./preview";
8+
import Preview from "./content-type/preview";
99

1010
export default {
1111
/**

0 commit comments

Comments
 (0)