docs/assets/dev/js/editor/document/component.md
Section ID - 98c3441
Column ID - 18f2ab4, 4b957d9
Widget ID - 5412776
Every element in the document has a unique ID which is used to identify it in the editor, and is resolved to a unique Container object that can be accessed using the following method:
elementor.getContainer( ID );
Every command under document uses container or containers as parameters to define the target.
The commands can accept container or containers but not both.
| Property | Type | Description |
|---|---|---|
| container | {Container} | Target. |
| containers | {Container[]} | Targets. |
$e.components.get('document')Document is used as namespace of describing changes in the document made by the command.| Component Name | Access Component | Description |
|---|---|---|
| Dynamic | $e.components.get('document/dynamic') | Dynamic enable, disable and change. |
| Elements | $e.components.get('document/elements') | Elements manipulation (create, edit, remove, etc.). |
| History | $e.components.get('document/history') | Provides a way to record/manipulate the commands history. |
| Repeater | $e.components.get('document/repeater') | Provides a way to communicate with repeaters. |
| Save | $e.components.get('document/save') | Responsible for saving the document (either publish/draft). |
| UI | $e.components.get('document/ui') | Irregular component for handling UI shortcuts. |
document -- Utils| Util Name | Access Util |
|---|---|
| findViewRecursive | $e.components.get('document').utils.findViewRecursive() |
| findViewById | $e.components.get('document').utils.findViewById() |
| findContainerById | $e.components.get('document').utils.findContainerById() |
$e.components.get('document').utils.findViewRecursive()Name: findViewRecursive.
Description: Find view recursively, the method will run recursively until it finds the view with given key & value.
Returns: {Array}
| Property | Type | Requirement | Description |
|---|---|---|---|
| parent | {Marionette.View} | required | Parent view. |
| key | {String} | required | Key of the view used to find the view. e.g: id. |
| value | {String} | required | Value of the view used to find the view. e.g: 98c3441. |
| multiple | {Boolean} | optional | default: {false}. allow multiple results. |
$e.components.get('document').utils.findViewById()Description: Find view by id, the method will run recursively until it finds the view with the given id.
Returns: { View | View[] }
| Property | Type | Requirement | Description |
|---|---|---|---|
| id | {String} | required | Id of the element. |
$e.components.get('document').utils.findContainerById()Name: findContainerById.
Description: Find container by id, the method will run recursively until it finds the {elementorModules.editor.Container} with given id.
Returns: { Container | Container[] }
| Property | Type | Requirement | Description |
|---|---|---|---|
| id | {String} | required | Id of the element. |