Skip to content

Commit

Permalink
Universal editor doc (#78)
Browse files Browse the repository at this point in the history
* - remove from the documentation not supported functionality

* - remove from the documentation not supported functionality
  • Loading branch information
irenelagno authored May 20, 2024
1 parent 2fea3ac commit 592eaee
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions src/pages/services/aem-universal-editor/api/events/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,23 @@ The Universal Editor sends defined events to remote applications. In case the re

### Working with Events

The Universal Editor offers a list of events that extensions can subscribe to in order to respond to changes in content or the user interface.
Refer to this [document](https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/implementing/developing/universal-editor/events) for the available event list.

For instance, here's an example of how to subscribe to the `aue:ui-select` event:

```js

useEffect(() => {
(async () => {
const guestConnection = await attach({id: extensionId});
...
await guestConnection.host.remoteApp.addEventListener('aue:ui-select', console.log('event recieved!'));
...
})();
}, []);
```

If your business logic requires sending an event to the Universal Editor, you can use the `dispatchEvent` method.
Here's an example of how to dispatch the `aue:ui-select` event:
If your business logic requires sending an event to the Universal Editor, you can use the `triggerEvent` method.
Here's an example of how to dispatch the `aue:ui-viewport-change` event:

```js
useEffect(() => {
(async () => {
const guestConnection = await attach({id: extensionId});
...
await guestConnection.host.remoteApp.dispatchEvent('aue:ui-select', {data: 'some data'});
await guestConnection.host.remoteApp.triggerEvent('aue:ui-viewport-change',
'main',
{
details: {
height: 1024,
width: 768,
}
}
);
...
})();
}, []);
Expand Down

0 comments on commit 592eaee

Please sign in to comment.