Skip to content

Commit 04218a0

Browse files
committed
MAGEDOC-3439: Edit architecture topic
# Conflicts: # docs/reference/architecture.md
1 parent 101ea54 commit 04218a0

File tree

1 file changed

+68
-64
lines changed

1 file changed

+68
-64
lines changed

docs/reference/architecture.md

Lines changed: 68 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,41 @@
11
# Architecture
22

3-
## What is PageBuilder
3+
## What is Page Builder
44

5-
PageBuilder is tool that simplifies content creation by letting you drag and drop content types and configure them without writing a line of code.
5+
PageBuilder is a tool that simplifies content creation by letting you drag-and-drop content types and configure them without writing a line of code.
66
Changes appear in real time in the preview area in the Admin and matches what users see on the storefront.
77

88
## Technologies
99

10-
PageBuilder is written in [TypeScript], a superset of JavaScript, that is compiled down to JavaScript prior to a release.
11-
Use the TypeScript components in the module as reference to understand the flow information.
10+
We wrote PageBuilder in [TypeScript], a superset of JavaScript. Before each release, we transpile the TypeScript to JavaScript.
11+
Use the TypeScript components in the module as a reference to understand the flow of information.
1212

1313
**Note:**
14-
*You do not need to use TypeScript in your module to work with the PageBuilder code.*
14+
*You need not use TypeScript in your module to work with the PageBuilder code.*
1515

16-
PageBuilder also uses core Magento technologies such as jQuery, Knockout & UI Components.
17-
It also uses additional libraries to help with various content types shipped with the module.
16+
PageBuilder also uses core Magento technologies such as jQuery, Knockout, and UI Components, along with additional libraries to help with various content types shipped with the module.
1817

1918
## Storage format
2019

21-
PageBuilder uses XHTML with inline styles and data attributes for storage and as the master format.
22-
This allows the content to be displayed with minimum changes to the Magento storefront and other third-party systems.
23-
24-
To display Page Builder content on storefront Magento and third party systems need to do the following
20+
**[Can you add a definition and explain what the master format is? The first sentence below is not clear.]**
2521

22+
PageBuilder uses XHTML with inline styles and data attributes for storage and as the master format.
23+
This allows Page Builder to display content with minimum changes to the Magento storefront and other third-party systems.
2624
Use the following steps to display PageBuilder content on a Magento storefront or third-party system:
27-
2825
<!-- {% raw %} -->
26+
2927
1. Replace all Magento directives such as `{{image url=path/to/image.png}}`
30-
2. Add custom stylesheet to provide the base styles that user can't edit.
31-
This includes styles for the content types such as `slider`, `tabs`, etc.
32-
3. After the content renders, load and initialize the widgets and libraries on the frontend that need initialization, such as slider, tabs, etc.
28+
2. Add custom stylesheet to provide the base styles that the user can't edit. This includes styles for the content types, such as the `slider` and the `tabs`.
29+
3. After the content renders, load and initialize the widgets and libraries on the frontend that need initialization, such as the `slider` and the `tabs`.
3330
<!-- {% endraw %} -->
3431

3532
## Integration with Magento and custom modules
3633

37-
When PageBuilder is enabled in the system configuration, it replaces all WYSIWYG instances.
38-
It does this by intercepting the WYSIWYG UI Component field and replacing the traditional WYSIWYG editor with the PageBuilder editor.
39-
40-
This means that any custom extension that utilizes the WYSIWYG field UI Component automatically supports the PageBuilder editor.
34+
**[This seems very relevant to our current issues with PB compatibility. Can you provide more detailed info on this topic?]**
4135

42-
To revert back to using the default WYSIWYG, add the following entry to the field configuration in the XML configuration file:
36+
When you activate PageBuilder, it replaces all WYSIWYG instances by intercepting the WYSIWYG UI Component field and replacing the traditional WYSIWYG editor with the PageBuilder editor.
37+
This means that you need to write any custom extension that uses the WYSIWYG field UI Component to support the PageBuilder editor.
38+
You can revert to using the default WYSIWYG again by adding the following entry to the field configuration in the XML configuration file:
4339

4440
```
4541
<item name="wysiwygConfigData" xsi:type="array">
@@ -49,80 +45,88 @@ To revert back to using the default WYSIWYG, add the following entry to the fiel
4945

5046
## Big picture
5147

52-
![Page Builder big picture](../images/big-picture.png)
48+
![Page Builder big picture](../../../images/big-picture.png)
5349

54-
| Entity | Name in configuration | Description |
55-
| ----------------- | --------------------- | -------------------------------------------------------------------------------------------------------------- |
56-
| Content type | `component` | View model responsible for rendering the preview and master format |
57-
| Preview component | `preview_component` | Contains preview specific logic that is generic for all appearances. Preview component is optional |
58-
| Master component | `content_component` | Contains master format rendering logic that is generic for all appearances. Content component is optional |
59-
| Data Store | | Contains data for the content type |
50+
| Entity | Name in configuration | Description |
51+
| ----------------- | --------------------- | ------------------------------------------------------------ |
52+
| Content type | `component` | View model responsible for rendering the preview and master format |
53+
| Preview component | `preview_component` | Contains preview specific logic generic for all appearances. Preview component is optional |
54+
| Master component | `content_component` | Contains master format rendering logic generic for all appearances. Content component is optional |
55+
| Data Store | | Contains data for the content type |
6056
| Appearance | `appearance` | Configuration for content type that defines look and behavior. Includes data mapping, form, templates, reader. |
61-
| Preview template | `preview_template` | Template used to display the element in the preview |
62-
| Master template | `master_template` | Template used to render the content type to the master format |
63-
| Form | `form` | Form that will be used to edit content type |
64-
| Reader | `reader` | Reads data for the content type from the master format |
57+
| Preview template | `preview_template` | Template used to display the element in the preview |
58+
| Master template | `master_template` | Template used to render the content type to the master format |
59+
| Form | `form` | Form used to edit attributes of the content type |
60+
| Reader | `reader` | Reads data for the content type from the master format |
6561

6662
## Data flow
6763

68-
![Page Builder data flow](../images/data-flow.png)
69-
64+
![Page Builder data flow](../../../images/data-flow.png)
7065
The following is a simple overview of the data flow:
7166

72-
1. Data is read by reader `Magento_PageBuilder/js/master-format/read/configurable`.
73-
2. Data for each element (`border`, `border_color`, `border_width` etc) is converted to an internal format by element converters.
74-
3. Data is converted by mass converters. For more details see [converter interface](../configurations/content-type-configuration.md).
75-
4. Content type is created and `Magento_PageBuilder/js/data-store` is populated with data.
76-
5. Data in the data store is modified in the form or using live edit.
77-
6. Data is converted by mass converters.
78-
7. It is then converted by element data converters.
79-
8. The preview and master component observables are updated.
80-
9. When the user saves the page's master format into the database, the editable with the PageBuilder entity attribute is updated.
67+
1. Page Builder's reader (`Magento_PageBuilder/js/master-format/read/configurable`) reads the data.
68+
2. Page Builder's element converters convert the data for each element (`border`, `border_color`, `border_width` etc) to an internal format.
69+
3. Page Builder's mass converters convert the data. For more details see [converter interface](../configurations/content-type-configuration.md).
70+
4. Page Builder creates its content types and populates the `Magento_PageBuilder/js/data-store` with data.
71+
5. End-users modify the data in the data store within the form editor or when using `live-edit` on the stage.
72+
6. Page Builder converts the data using mass converters.
73+
7. Page Builder converts the data using element data converters.
74+
8. Page Builder updates the preview and master component observables.
75+
9. When the end-user saves the page's master format into the database, Page Builder updates the editable entity attribute.
8176

8277
### Mass converter
8378

84-
A Mass converter modifies data for all content type elements.
85-
For example, the content type of two elements, main and image has data stored in the fields `border`, `border_color`, `border_width`, `background_image`.
86-
A mass converter allows you to modify all these fields.
79+
A Mass converter changes data for all content type elements.
80+
For example, the content type for two elements, main and image, has data stored in the fields `border`, `border_color`, `border_width`, `background_image`.
81+
A mass converter allows you to change all these fields.
8782

88-
For more information, read about how [data is stored internally](#Datastore).
83+
**[Can you provide a small snippet of code that shows briefly what using a mass converter looks like within a content type.]**
84+
85+
For more information, read about how Page Builder [stores data](#datastore).
8986

9087
### Element converter
9188

92-
An element converter modifies a single field at a time.
89+
An element converter changes a single field at a time.
9390

9491
## Datastore
9592

96-
Data for content types are stored in a simple object called the DataStore `Magento_PageBuilder/js/data-store`.
93+
Page Builder stores data for content types in a simple object called the DataStore: `Magento_PageBuilder/js/data-store`.
94+
95+
9796

98-
`var` from [content type configuration](../configurations/content-type-configuration.md) is the name of a parameter in the DataStore.
97+
**[Can you provide more information to the paragraph below needs more explanation. I'm not sure what significance the parameter `var` has. It was just mentioned but it needs more info on its use and significance]**
9998

100-
You can use the `subscribe` method to subscribe to changes in the data and perform custom action on it.
99+
The parameter `var` from [content type configuration](../configurations/content-type-configuration.md) is the name of a parameter in the DataStore.
100+
You can use the `subscribe` method to listen for changes in the DataStore and perform custom actions on the data.
101101

102102
## Content type configuration
103103

104-
Please see [content type configuration](../configurations/content-type-configuration.md) for information on content type configuration.
104+
Please see [content type configuration](../configurations/content-type-configuration.md) for more information.
105105

106106
## Appearances
107107

108-
Appearances allow you to make the following customization on existing content types:
108+
Appearances allow you to customize existing content types as follows:
109109

110-
1. Add new style properties to existing content types
111-
2. Add new attributes to existing content types. This is similar to above.
112-
3. Change templates
113-
4. Move data between elements, achieved with data mapping configuration.
110+
1. Add new style properties to existing content types.
111+
2. Add new attributes to existing content types. This is similar to adding new style properties.
112+
3. Change templates.
113+
4. Move data between elements, by data-mapping within the content type's configuration file.
114114
For example, a developer can move the `margin` style property from one element to another.
115-
5. Change the form for a [content type]
115+
5. Change the form for a [content type].
116116

117117
## Module structure
118118

119-
| File type | Location |
120-
| -------------------------|------------------------------------------------------------------------------------------------|
121-
| Content type components | `Vendor/ModuleName/view/adminhtml/web/js/content-type/content-type-name` |
122-
| Content type templates | `Vendor/ModuleName/view/adminhtml/web/template/content-type/content-type-name/appearance-name` |
123-
| Styles | `Vendor/ModuleName/view/adminhtml/web/css/source/content-type/content-type-name` |
119+
| File type | Location |
120+
| ----------------------- | ------------------------------------------------------------ |
121+
| Content type components | `Vendor/ModuleName/view/adminhtml/web/js/content-type/content-type-name` |
122+
| Content type templates | `Vendor/ModuleName/view/adminhtml/web/template/content-type/content-type-name/appearance-name` |
123+
| Styles | `Vendor/ModuleName/view/adminhtml/web/css/source/content-type/content-type-name` |
124+
125+
126+
127+
**[Is the note below still relevant?]**
124128

125129
**Note:**
126-
*We also considered introducing appearance component and/or moving the initialization of the libraries to bindings. This would allow you to add custom logic per appearance changes and libraries per appearance for content types like slider, tabs, etc.*
130+
*We also considered introducing appearance component and/or moving the initialization of the libraries to bindings. This would allow you to add custom logic per appearance changes and libraries per appearance for content types like the `slider` and the `tabs`.
127131

128-
[TypeScript]: https://www.typescriptlang.org/
132+
[TypeScript]: https://www.typescriptlang.org/

0 commit comments

Comments
 (0)