|
| 1 | +--- |
| 2 | +title: Universal Editor Extensibility |
| 3 | +description: Actions that can be performed from extensions |
| 4 | +contributors: |
| 5 | + - https://github.com/AdobeDocs/uix |
| 6 | +--- |
| 7 | + |
| 8 | +# Actions that can be performed from extensions |
| 9 | + |
| 10 | +Understand the fundamentals required to develop an extension for the Universal Editor. |
| 11 | + |
| 12 | +## List of actions: |
| 13 | + |
| 14 | +### Navigate To |
| 15 | + |
| 16 | +Universal Editor provides `navigateTo` action, enables switching the URL to the editor content page from the extension. |
| 17 | +To execute this action, an extension developer can call the navigateTo method on connection.host.editorActions and provide the new content URL as a parameter. |
| 18 | + |
| 19 | +#### API |
| 20 | +Method: `navigateTo` |
| 21 | + |
| 22 | +| Param | Type | Description | |
| 23 | +|------------|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 24 | +| href | `string` | Path to the content page | |
| 25 | + |
| 26 | + |
| 27 | +Example: |
| 28 | +`guestConnection.host.editorActions.navigateTo(href: string);` |
| 29 | + |
| 30 | +### Select Editables |
| 31 | +The `selectEditables` action allows an extension developer to select an editable block for editing. An editable block refers to the portion of content that can be modified within the Universal Editor. |
| 32 | + |
| 33 | +Editable block example: |
| 34 | + |
| 35 | + |
| 36 | +The extension developer can retrieve the list of all editable blocks from the [editor state](https://developer.adobe.com/uix/docs/services/aem-universal-editor/api/data/#editor-state). This can be achieved by using `await guestConnection.host.editorState.get()` api. |
| 37 | + |
| 38 | +#### API |
| 39 | + |
| 40 | +Method: `selectEditables` |
| 41 | + |
| 42 | +| Param | Type | Description | |
| 43 | +|------------|---------------------|---------------------------------| |
| 44 | +| editables | `Array` | The list of Editables to select | |
| 45 | + |
| 46 | +Example: `guestConnection.host.editorActions.selectEditables(editables: Editable[]);` |
| 47 | + |
| 48 | +### Update |
| 49 | + |
| 50 | +The update action enables an extension developer to modify the data within a specific editable block. |
| 51 | + |
| 52 | +At present, only a single field can be updated per call, and only the replace operation is supported. If the provided patch does not adhere to these rules, an error will be triggered. |
| 53 | + |
| 54 | + |
| 55 | +#### API |
| 56 | + |
| 57 | +Method: `update` |
| 58 | + |
| 59 | +| Param | Type | Description | |
| 60 | +|------------|----------|------------------------------------------------------| |
| 61 | +| target | `Object` | The editable to update | |
| 62 | +| patch | `Arrap` | The path to the specific edirable property to update | |
| 63 | + |
| 64 | +Example: |
| 65 | +`guestConnection.host.editorActions.update({ target: Target, patch: JSONPatch });` |
| 66 | + |
| 67 | +Example for updating a field with the name title: |
| 68 | +`update({ target: { editable }, patch: [{ op: "replace", path: "/title", value: "New title" }] })` |
| 69 | + |
| 70 | + |
0 commit comments